[Tutor] XML Programs

Albert-Jan Roskam sjeik_appie at hotmail.com
Sat Apr 21 05:50:52 EDT 2018


On Apr 21, 2018 09:06, Peter Otten <__peter__ at web.de> wrote:
>
> Glen wrote:
>
> > Thank you for your comprehensive reply. It was very helpful!
> > Just to clarify one point, is it not possible to search for a node
> > directly in the element / elementTree or do you first need to pull the
> > data into a class/dict?
>
> You certainly have other options
>
> >>> catalog.xpath("//catalog/book[contains(title,'Guide')]/title/text()")
> ["XML Developer's Guide", 'MSXML3: A Comprehensive Guide', 'Visual Studio 7:
> A Comprehensive Guide']
> >>> catalog.xpath("//catalog/book[starts-
> with(author,'Corets')]/title/text()")
> ['Maeve Ascendant', "Oberon's Legacy", 'The Sundered Grail']
>
> but then the question is whether you want to learn Python or XPath.

Neat! Can you recommend a good resource (book, webpage) for learning Xpath?


More information about the Tutor mailing list