[libxml2] Account for ID attributes in xmlSetTreeDoc



commit f54d6a929af2a570396f0595a0e29064c908c12e
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Dec 19 00:08:35 2014 +0100

    Account for ID attributes in xmlSetTreeDoc

 tree.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/tree.c b/tree.c
index 6ec9223..c6323b4 100644
--- a/tree.c
+++ b/tree.c
@@ -2799,8 +2799,19 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
        if(tree->type == XML_ELEMENT_NODE) {
            prop = tree->properties;
            while (prop != NULL) {
+                if (prop->atype == XML_ATTRIBUTE_ID) {
+                    xmlRemoveID(tree->doc, prop);
+                }
+
                prop->doc = doc;
                xmlSetListDoc(prop->children, doc);
+
+                if (xmlIsID(doc, tree, prop)) {
+                    xmlChar *idVal = xmlNodeListGetString(doc, prop->children,
+                                                          1);
+                    xmlAddID(NULL, doc, idVal, prop);
+                }
+
                prop = prop->next;
            }
        }


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