- https://en.wikipedia.org/wiki/XPath#Implementations has a section on Python
- http://shop.oreilly.com/product/9780596001285.do — O’Reilly Media book: Python & XML — published in 2003, you cannot use the “4DOM” samples any more — I discussed it a little in this article (on this blog): http://wp.me/p4qjMw-1Ac
- https://docs.python.org/3/library/xml.etree.elementtree.html#xpath-support
- https://docs.python.org/2/library/xml.etree.elementtree.html#xpath-support
- the Python2 and Python3 samples are practically the same, you can use identical code (apart from the “print” and “format” stuff)
I had done some XPath using XMLStarlet in a shell script, and I quite like it.
Feeling “safe enough” with XPath I managed to deal with the Python XPath pitfall(s), and I quite like my 1st respective XPath Python script. And of course my Python script has a nicer CLI interface than my shell script.
My Python XPath pitfall briefly: You cannot (at least by my impression) start an XPath expression from the root — simply omit the root and you are fine.