GNOME Bugzilla – Bug 741444
Combining XML_PARSE_NOCDATA with XML Schema causes loss of CDATA sections.
Last modified: 2021-07-05 13:27:19 UTC
Created attachment 292613 [details] reproducer When the XML Reader API is used with XML_PARSE_NOCDATA and XML Schema validation, then LibXML2 appears to drop CDATA sections. The text it returns is as if the CDATA sections were empty. The attached program works on this XML code: "<test>one <![CDATA[two]]> three</test>" It parses this code three times with different combinations of validation and NOCDATA, and lists the nodes it encounters. It should find the same content whether validation is enabled or not. This is the actual output: validating, not decoding CDATA: start tag text: "one " CDATA: "two" text: " three" end tag not validating, decoding CDATA: start tag text: "one two three" end tag validating, decoding CDATA: start tag text: "one three" end tag 1 errors detected
I tried to validate it with the "xmllint" program, using the --nocdata --schema option. The result of the operation is ok. So, this error may not be a bug in libxml2, more likely a program logic problem
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.