[libxml2] Use actual doc in xmlTextReaderRead*Xml



commit 39fbfb4fd08eae88d4b0c15f3a8ac33babc740e6
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Sep 25 12:57:04 2018 +0200

    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.

 xmlreader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/xmlreader.c b/xmlreader.c
index 5aee3395..df395347 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -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 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]