antchfx / xmlquery

xmlquery is Golang XPath package for XML query.
https://github.com/antchfx/xpath
MIT License
444 stars 89 forks source link

cdata with formatted xml #56

Closed james-lawrence closed 1 year ago

james-lawrence commented 3 years ago

the tokenizer emits the opening < as a single character text node when XML is formatted resulting in the cdata check failing.

there might be a better fix in the tokenizer.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.04%) to 92.569% when pulling 7c5d18be10d773500f3c138eb0dcb015c06ed4c7 on james-lawrence:enh/cdata-output into e73954f0f504eaf97f73ad62a4c52419e304b7bd on antchfx:master.

zhengchun commented 3 years ago

You mean the <![CDATA[foo]]> block missing a < in XML? the XML like this ![CDATA[foo]]>? I think if CDATA missing < as prefix it is not correct XML document, What do you think?

james-lawrence commented 3 years ago

@zhengchun no, the XML is correctly formatted. see the two tests. the tokens generated by the parse are different between formatted XML and unformatted XML

formatted xml the parser generates the tokens: {Type: Text, Data: "<"} {Type: Text, Data: "![CDATA[..."}

unformatted xml the parser generates the token: {Type: Text, Data: "<![CDATA[..."}