Does ElementTree's Parent XPath actually work?

Jason Cooper skawaii at gmail.com
Fri Mar 9 12:24:04 EST 2012


I'm curious to know if anyone with ElementTree 1.3 has gotten the parent XPath to work? According to http://effbot.org/zone/element-xpath.htm, you should be able to do 

  >>> import xml.etree.ElementTree as et
  >>> et.VERSION
  '1.3.0'
  ...
  >>> elem.find('..')
  >>> 

but that always return None for me. Has anyone else seen this particular XPath work? Am I just doing something wrong?

Thanks for you help!
Jason

PS. In case you're wondering, yes I know that lxml supports parent points and, yes, I'm aware of http://effbot.org/zone/element.htm#accessing-parents. I'm really wondering if the mentioned XPath is broken or something.



More information about the Python-list mailing list