Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about whitespace

Status
Not open for further replies.

jisoo23

Programmer
Jan 27, 2004
192
US
Hello all,

This is probably an easy question so please forgive as the search function on the forum seems to be down. I have an attribute in an xml file with a value that contains whitespace, i.e.:

<code>
<attribute name="thisname" value="this & that"/>
</code>

When I display it in Internet Explorer, an error message shows up saying that it cannot be displayed. Does anyone know the appropriate way to handle whitespace inside an attribute value?

Thanks in advance,
Jisoo23
 
Oops, <code> and </code> is supposed to be
Code:
 and
.
 
The ampersand is a reserved character in XML, and it must be escaped:
Code:
<code>
<attribute name="thisname" value="this &amp; that"/>
</code>
The reserved characters (entities) are:
[ignore]
& ---> &amp;
' ---> &apos;
" ---> &quot;
< ---> &lt;
> ---> &gt;
[/ignore]

Chip H.

____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top