[xml] xmlAddChild behavior



hi there,

I'm reading the code for xmlAddChild, and I'm wondering
about what I read as a mismatch between docs and code:

The docs state:

* If the new node was already inserted in a document it is
* first unlinked from its existing context.

While the code reads:

    if (cur->doc != parent->doc) {
        xmlSetTreeDoc(cur, parent->doc);
    }

The small but important difference is that I interpreted 'unlink from
its existing context' as 'taking the node out of the document', while
the actual code only adjusts the doc pointer, if needed.
(I would have thought that xmlUnlinkNode is called...)

Would that be worth a clarification in the docs ?

Stefan




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