The limit of Element Tree on xpath

DrooBey

New Member
I've used Element Tree for a while and i love it because of its simplicityBut I'm doubting of its implementation of x pathThis is the XML file\[code\]<a> <b name="b1"></b> <b name="b2"><c/></b> <b name="b2"></b> <b name="b3"></b></a>\[/code\]The python code\[code\]import xml.etree.ElementTree as ETtree = ET.parse('test.xml')root = tree.getroot()root.findall("b[@name='b2' and c]")\[/code\]The program shows the error: \[code\]invalid predicate\[/code\]But if I use \[code\]root.findall("b[@name='b2']") or root.findall("b[c]")\[/code\]It works,
 
Back
Top