Re: [libxml++] Re: [Libxmlplusplus-general] Adding STL-container-like methods to Node instead of returning a container instance



Christophe de VIENNE wrote:

I did not look at xpath in libxml2 but I guess that NodeSet could be a wrapper around the libxml2 structure returned by xpath operations, and implement STL-like methods which access the libxml2 container.

eventually, may be (I don't fully understan that structure either, as it
may contain more than just a 'NodeSet'). For now I think it's *much* simpler to copy the references into a std::vector instead of rewriting
a new container that wrapps this libxml2 structure.

On the other hand, DV hinted at a potential problem with nodes that exist only temporarily (namespace attributes, I think), which are deleted by libxml2 as soon as the xpath lookup is over. We'll run into
a bug as soon as we use xpath to find these namespace attributes, as the
returned nodes (in our NodeSet container) wouldn't be valid as soon as
the xpath lookup is over (i.e. xmlXPathFreeObject is called).

That's one thing where I'm reluctant to go for a complete API *right now*, just because it's complex, and chances that anybody will run into
it are tiny. But yes, eventually these issues have to be addressed.

Stefan





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