Friday, April 24, 2009

simple xpath for python: minixpath

To me, if XML is still alive today it's because of xpath. xpath in it self was able to resume a complex XML search into a single string, making XML finally easy to parse.

Still today, full xpath spec is difficult to support on many language; sadly including Python. While xpath is pretty powerfull, sometime you just need xpath to get node with a filter name. But still, 'sum', 'count' is cool, it does add the complexity and support for the expression parser.

Since Python doesn't come with a native xpath support, I wrote a simple xpath parser. It was written with the "minidom" concept in mind... Again, to my opinion, it does 80% of what you need for a xpath parser does: find a node...


No comments: