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

Use of & in content of XML document

Status
Not open for further replies.

bostonrose

Technical User
Nov 13, 2001
3
US
I am very new to XML and have to create a once every three year document for the state. I have created it, but the content of one of my elements is a name of a company and includes the character & like "Harry & David". When I parse this in IE, I get an error. What is the alternative - is there something I need to do around the "&" sign so it will not get a parsing error and be considered valid XML? Thanks, Bostonrose
 
doh! it escaped it!

view source on the document and look at the <title> of the html.

:)
 
Here we go, how about &amp;amp;amp;
if that doesn't work, try &amp;_a_m_p_; without underscores :p
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Thanks everyone for trying, I tried what you suggested with no luck. Perhaps I didn't explain myself correctly since I don't know much about xml. I have file with .xml for it's extension and in there I have the following:
<AgencyName>H.O. Perry & Son</AgencyName> and it gives me an error on the &. I guess I could change the & to &quot;and&quot; as a last resort. Thanks, again. Bostonrose



 
Just change it to the &amp;amp;. This is an escape sequence that should process as an &amp; and stop causing you problems.
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Thanks Tarwn, I did used &quot;&amp;&quot; after I finally understood what everyone was saying, and as you say, it worked great. Thanks for the help. When I saw it on the post it converted to a & sign of course, so I was a little confused. Bostonrose
 
Don't thank me, I just clarified what everyone else was saying, after adding to the general confusion :p
Several other beat me to the post with this one :)
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top