comp.text.xml
[Top] [All Lists]

Re: First character a space in tag?

Subject: Re: First character a space in tag?
From: Gabe
Date: Fri, 18 Jul 2008 14:20:16 -0700 PDT
Newsgroups: comp.text.xml

On Jul 18, 4:24 pm, "Joseph J. Kesselman" <keshlam-nos...@xxxxxxxxxxx>
wrote:
> Gabe wrote:
> > <name>.John Smith</name>
> > and I want it to print as:
> > .John Smith
> > where "." = a space.
>
> You can do exactly that, exactly as you've shown it:
>         <name> John Smith</name>
>
> But...
>
> > I need to do this because the software I am using requires the
> > following code for a multi-select drop down list.
>
> Now you aren't talking about XML -- you're talking about the behavior of
> the tool you're passing the XML to.
>
> Assuming it's a browser, that's your problem; browsers are designed to
> reformat text, and consider spaces in text to be only hints. You can try
> replacing the space with a Required Blank character:
>         <name>&#160;John Smith</name>
> Required Blank displays as a space but is not subject to the browser's
> reformatting.
>
> If the tool isn't a browser, you need to understand that tool's rules
> for when spaces are and aren't preserved.
>
> If you need additional help, it would be really useful to know exactly
> what you're feeding this document to.

Thanks Joseph for answering my question.

It is actually a forms editor where I first import a wmf form. Then I
do most of the xml coding with a WYSIWYG editor. When I save the file
with the leading space and reopen the file, the space is gone.

I had tried your solution before posting to this group. It works great
when I test it, but then when I save the file and reopen it, it does
this:

<name>&amp;#160;John Smith</name>

which is not what I want.

I will talk with the developer of the application about this.

Thanks for your help,

Gabe

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy