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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using special characters as part of a value of an element attribute?

Status
Not open for further replies.

patilsaab

Programmer
Dec 20, 2006
2
US
Hello,

How can we/can we use special characters as a value of an element attribute. For eg: when i use something like:

<comics name="cow & boy">xyz</comics> or

<comics name="jane's world">abc</comics>

the xml parser breaks b/c of & and '
Any clues as to how to use special characters within the xml element? Or special characters cannot be used like this? I tried using &amp; for & and &apos; for ' but it doesn't seems to work either. It just seems like a very trivial thing but does anyone how use special characters in this manner?

Thanks.
 
><comics name="cow & boy">xyz</comics>
[tt]<comics name="cow &amp; boy">xyz</comics>[/tt]

><comics name="jane's world">abc</comics>
Don't see any problem.
 
Actually I gave that a shot and I am still having trouble parsing the xml, it still breaks.
 
> I am still having trouble parsing the xml
How? It is simple. Either it is (after my correction) is not a well-formed xml document or you parse wrong. I believe it is well-formed thereafter, so my conclusion is you parse wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top