Andrew Lonie
1/10/2008 9:41:00 PM
Hi I noticed that the xpath functionality of elementtree has been
upgraded in version 1.3. However I can't seem to get the [postion]
predicate to function. All the other new functionality seems to be
working.
Maybe I'm getting the syntax wrong?:
>>> xml = ET.XML("""<root><tag att="1">text</tag><tag
att="2">text2</tag></root>""")
>>> elem = xml.find("tag[@att]") #Works fine - returns first tag element
>>> elem = xml.find("tag[@att]/..") #Works fine - returns entire doc
>>> elem = xml.find("tag[1]") # FAILS - returns nothing. Should
return first tag element.
Any help appreciated!
Andrew