[xml] SAX2.c xmlSAX2AttributeNs problem with doc



I hit a problem where the attribute value (text node) doesnt get the correct
doc set.
Sorry, dont have a self contained example as I pulled thise from various
functions which demonstrates the problem.

I am doing the following (where doc is an existing doc and nodep is an
element in the doc:
data contains: <a href='&amp;'></a>

xmlParseBalancedChunkMemory(doc, NULL, NULL, 0, data, &lst);
xmlAddChildList(nodep,lst);

The text node - & - retains the document ctxt->myDoc rather than the doc
passed into xmlParseBalancedChunkMemory

not sure which is the best/correct fix to use though (the differences being
which document an error is associated with if one occurs as well as it
doesnt look like standalone is set on ctxt->myDoc if xmlGetDocEntity were to
be called).

***************
*** 1824,1829 ****
--- 1824,1830 ----
            valueend - value);
       tmp = ret->children;
       while (tmp != NULL) {
+   tmp->doc = ret->doc;
    tmp->parent = (xmlNodePtr) ret;
    if (tmp->next == NULL)
        ret->last = tmp;

or just:

     ret->children = xmlStringLenGetNodeList(ret->doc, value,
          valueend - value);

Rob





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