Re: Problem parsing a string with special character '&'
Nick MacDonald <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Reading the XML 1.1 standard document (from http://www.w3.org/TR/2004/REC-xml11-20040204/ ) in section 2.4 you find the following text: The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings "&" and "<" respectively. The right angle bracket (>) MAY be represented using the string ">", and MUST, for compatibility, be escaped using either ">" or a character reference when it appears in the string "]]>" in content, when that string is not marking the end of a CDATA section. So, when you used & did you include the semicolon? For example: <audio uri=" annlab://VarAnn/format?type5=digits&value5=0122333&locale5=en_US"> (Note, I personally have not tested this recommendation in Expat, but it makes sense from my reading of the XML spec.) Nick On 12/5/05, [email protected] <[email protected]> wrote: > > > I'm having problems parsing an XML document with a tag <audio > uri="annlab://VarAnn/format?type5=digits&value5=0122333&locale5=en_US">. > I get a XML parsing error everytime I use the special character & in the > string. Tried using & instead, but it does not help. > > Expat is able to parse other characters like '!' etc. > > Would greatly appreciate any suggestions/solutions for this problem. > -- Nick MacDonald [email protected]