1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-27 03:21:26 +03:00

Use actual doc in xmlTextReaderRead*Xml

Otherwise the encoding of the document is ignored and non-ASCII
characters are serialized as numeric references even if the encoding
is specified as UTF-8.
This commit is contained in:
Nick Wellnhofer 2018-09-25 12:57:04 +02:00
parent da35eeae5b
commit 39fbfb4fd0

View File

@ -1711,10 +1711,11 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
doc = reader->doc;
doc = reader->node->doc;
buff = xmlBufferCreate();
for (cur_node = reader->node->children; cur_node != NULL;
cur_node = cur_node->next) {
/* XXX: Why is the node copied? */
node = xmlDocCopyNode(cur_node, doc, 1);
buff2 = xmlBufferCreate();
if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
@ -1755,10 +1756,11 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
xmlDocPtr doc;
node = reader->node;
doc = reader->doc;
doc = node->doc;
if (xmlTextReaderExpand(reader) == NULL) {
return NULL;
}
/* XXX: Why is the node copied? */
if (node->type == XML_DTD_NODE) {
node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
} else {