xmlTextReaderReadOuterXml returns unexpected (NULL) result
Using the below input (test_xml1), xmlTextReaderReadOuterXml returns unexpected (NULL) result while xmlTextReaderRead is positioned on the "ns:objB_4" node.
Actual output: NULL
Expected output:
"<ns:objB_4 xmlns:ns=\"http://www.example.org/ns\">"
"<b>this is</b> mixed content &EA;</ns:objB_4>"
This appears to be a regression due to https://github.com/GNOME/libxml2/commit/7618a3b15947cd28a060bde24992f8a96256d7d4 (reverting this commit fixes the issue).
The problem reproduces with:
char test_xml1[] =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
"<?my_instruction my_value?>\n"
"<!DOCTYPE my_document SYSTEM \"example.dtd\" [\n"
" <!ENTITY EA \"EA Value\">\n"
" <!ENTITY EB \"EB Value\">\n"
"]>\n"
"<ns:obj xmlns:ns=\"http://www.example.org/ns\">\n"
" <ns:objA>value A</ns:objA>\n"
" <!-- my comment -->\n"
" <ns:objB>\n"
" <ns:objB_1>value B1</ns:objB_1>\n"
" <ns:objB_2><![CDATA[some <br/> data]]></ns:objB_2>\n"
" <ns:objB_3>&EB;</ns:objB_3>\n"
" <ns:objB_4><b>this is</b> mixed content &EA;</ns:objB_4>\n"
" </ns:objB>\n"
" <ns:objC ns:attr1=\"value C1\" ns:attr2=\"value C2\"/><ns:objD>"
"</ns:objD>\n"
"</ns:obj>\n";
The problem does not reproduce with simpler input like:
char test_xml2[] =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
"<ns:obj xmlns:ns=\"http://www.example.org/ns\">\n"
" <ns:objB>\n"
" <ns:objB_1><b>this is</b> mixed content</ns:objB_1>\n"
" </ns:objB>\n"
"</ns:obj>\n";
Edited by Marshall Greenblatt