Martijn Faassen wrote:
[snip]
> Well, that gives one no way to access any comments surrounding the
> document library from XPath. Not a disaster, but still. Returning
> something Element-like sounds the most natural in this case, just like
> returning a string is most natural for attribute nodes.
I've just checked in a branch here:
http://codespeak.net/svn/lxml/branch/lxml-xpathroot
which experiments with adding a special XPath Root object. This root
object only shows up when accessing / through XPath - there's no way to
get to it using the normal ElementTree functionality. At first sight
this implementation doesn't appear to be too difficult. I think this is
a nicer solution than just not returning anything.
Unfortunately, my changes also cause memory errors when running the
test. It's possible this happens because we start stuffing our proxy in
the _private of a XML_DOCUMENT_NODE, something that wasn't possible
before, and we're probably not scanning for accurately in our
deallocation logic. Don't have time to investigate this further now
though, so I'll leave it in the branch for now. Feel free to
investigate, Stefan. :)
Regards,
Martijn
|