summaryrefslogtreecommitdiff
path: root/debian/patches/0005-Account-for-ID-attributes-in-xmlSetTreeDoc.patch
blob: 18d77206a7b5920bbc7c776e7e1bc00427d17064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 19 Dec 2014 00:08:35 +0100
Subject: Account for ID attributes in xmlSetTreeDoc

---
 tree.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tree.c b/tree.c
index 307782c..ff9a890 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;
 	    }
 	}