
Jan. 16, 2012
8:03 a.m.
Le 15/01/2012 16:27, Mag Gam a écrit :
Hello,
I have a xml file like this, http://msdn.microsoft.com/en-us/library/windows/desktop/ms762271(v=vs.85).as...
Lets say I want to get all the book titles authored by, ¨O'Brien, Tim¨. What is the best way to do that?
Hi, Have you looked at XPath? http://lxml.de/xpathxslt.html The link above is for the lxml API. There are many resources on the web for learning the XPath syntax. Your example would be something like this (untested) element_list = some_lxml_tree.xpath( '/book[author/text() = "O'Brien, Tim"]') Regards, -- Simon Sapin