xml-light icon indicating copy to clipboard operation
xml-light copied to clipboard

Error parsing document containing '>'

Open manfredlotz opened this issue 9 years ago • 1 comments

I have a small document like this:

<?xml version="1.0"  encoding="utf-8"?>
<entry>
   f --> g
</entry>

Parsing it with xml-light yields: Xml node expected line 3 character 7

xmllint command line utility shows it as well formed. AFAIK, '>' is allowed in this context (although perhaps &gt; might be preferable).

manfredlotz avatar Feb 03 '17 04:02 manfredlotz

As for xmllint:

$ xmllint test-xml.xml
<?xml version="1.0" encoding="utf-8"?>
<entry>
   f --&gt; g
</entry>

xmllint seems to correct ">" to the reference "&gt;"

As for ">" in xml generally: 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. ( https://www.w3.org/TR/2008/REC-xml-20081126/#syntax )

Which also seems to explain the behaviour of xmllint.

salamynder avatar Apr 30 '18 14:04 salamynder