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

Re: First character a space in tag?

Subject: Re: First character a space in tag?
From: "Joseph J. Kesselman"
Date: Fri, 18 Jul 2008 16:24:42 -0400
Newsgroups: comp.text.xml


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.

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