Re: [xml] XPath "//namespace::*" and xml: weirdness

Daniel Veillard wrote:
Read the spec, then raise an issue iif you think libxml2 behaviour
deviates from the spec, thanks.

I wasn't questioning libxml's behavior at all, just inquiring about the details of the implementation. Digging in the source found me the answer to my question (reproduced here to hopefully help those of later generations encountering the same problem).

My example returned 3 different xmlNs structs, all for the xml namespace. Where did those come from? Are the referenced in the tree somewhere? All the nodes have null nsDef fields, the doc's oldNs field is null.

Looking at xmlXPathFreeNodeSet in xpath.c verifies that those xmlNs structs were instantiated just for those XPath results (as each struct's "next" pointer points to the element it "came" from), as they're destroyed when the xmlXPathObject is freed.

Definite implications for wanting to keep the pointers from the xmlXPathObject around after it was closed. :)


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