Elementtree 1.3 and xpath

A

Andrew Lonie

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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top