| Index: third_party/libxml/src/tree.c
|
| diff --git a/third_party/libxml/src/tree.c b/third_party/libxml/src/tree.c
|
| index 307782cf4722ecc6c55fa9a0b73dbd6f07b99ce7..6a158cec335bc8436b5393291e3eb6227633c002 100644
|
| --- a/third_party/libxml/src/tree.c
|
| +++ b/third_party/libxml/src/tree.c
|
| @@ -1451,9 +1451,9 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
|
| node->content = xmlBufDetach(buf);
|
|
|
| if (last == NULL) {
|
| - last = ret = node;
|
| + ret = node;
|
| } else {
|
| - last = xmlAddNextSibling(last, node);
|
| + xmlAddNextSibling(last, node);
|
| }
|
| } else if (ret == NULL) {
|
| ret = xmlNewDocText(doc, BAD_CAST "");
|
| @@ -1639,9 +1639,9 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
|
| node->content = xmlBufDetach(buf);
|
|
|
| if (last == NULL) {
|
| - last = ret = node;
|
| + ret = node;
|
| } else {
|
| - last = xmlAddNextSibling(last, node);
|
| + xmlAddNextSibling(last, node);
|
| }
|
| }
|
|
|
| @@ -2799,8 +2799,27 @@ 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);
|
| +
|
| + /*
|
| + * TODO: ID attributes should be also added to the new
|
| + * document, but this breaks things like xmlReplaceNode.
|
| + * The underlying problem is that xmlRemoveID is only called
|
| + * if a node is destroyed, not if it's unlinked.
|
| + */
|
| +#if 0
|
| + if (xmlIsID(doc, tree, prop)) {
|
| + xmlChar *idVal = xmlNodeListGetString(doc, prop->children,
|
| + 1);
|
| + xmlAddID(NULL, doc, idVal, prop);
|
| + }
|
| +#endif
|
| +
|
| prop = prop->next;
|
| }
|
| }
|
|
|