Slou wrote:
Here are several features I miss in lxml:
- ability to get namespace of the node without parsing .tag property
(which is concatenated on library side, so double amount of meaningless work is done)
There's a 'prefix' property now in the trunk version. It should be easy enough to add a namespace URI property as well.
- ability to get short name of the node
This would be the local name, right? Shouldn't be too hard to add a localname property as well.
- ability to get parent node without .xpath('../')[0] which seems overkill to me
Yeah, though I'm a bit wary of extending the ElementTree API so fundamentally. Since we have the ability with libxml2, we should exploit it though, I guess.
- ability to get absolute xpath of node
This one I need to think about; I believe libxml2 has a facility for this, but research would need to be done. If you can find out the API in libxml2 and submit a patch, that'd be great!
I may be wrong and some things that I want may be inconsistent with lxml design and usage patterns, correct me in this case.
Anyway lxml is the best xml-processing library for Python, thanks for your work!
Thanks for the feedback! I'll consider implementing your suggestions. It shouldn't be too hard to implement a bunch of read-only properties for this. I'm wary to make them writeable, as that might involve DOM-like complexity, but read-only should be simple. The 'getting the xpath expression of a node' requires some more puzzling though; let's talk about this more. Regards, Martijn