PDA

View Full Version : XML parser doesn't read < > in quotes (resolved)



para
30 Apr 2007, 6:28 AM
I don't know if you wrote the xml parser or not, but it seems that there is a bug.
The < and > characters are not parsed correctly. If they are contained within quotes they should not be parsed as normal, but as a string.
This line is causing my system to crash.

<treeProperty id="text" default="<-=-=-=->" />

Any suggestions?

KimH
30 Apr 2007, 6:35 AM
I don't know if you wrote the xml parser or not, but it seems that there is a bug.
The < and > characters are not parsed correctly. If they are contained within quotes they should not be parsed as normal, but as a string.
This line is causing my system to crash.

<treeProperty id="text" default="<-=-=-=->" />

Any suggestions?

Yep! Replace the < and > characters with &lt; and &gt; inside the attribute value !!!

According to the XML specification these characters "...MUST NOT appear in their literal form, except when used as markup delimiters, or within comment, a processing instruction , or a CDATA section." [ref.: XML Specification (http://www.w3.org/TR/xml/#syntax)]

CableDawg
30 Apr 2007, 6:37 AM
I believe that does not work because that is not valid XML. If you want < >'s, put them in a CDATA block.


<treeProperty id="text">
<myAttr><![CDATA[<-=-=-=->]]></myAttr>
<contents>tree text here</contents>
</treeProperty>

Or something similar.

See also: http://www.w3schools.com/xml/xml_cdata.asp

para
30 Apr 2007, 6:39 AM
Sorry. I was unaware of those xml rules.
I hereby retract my complaint :)