kimmyaf, 26.04.2010 23:14:
Stefan Behnel-3 wrote:
kimmyaf, 26.04.2010 00:24:
Hello. I've only done a litte bit of parsing with minidom before but I'm
having trouble getting my values out of this xml. I need the latitude and
longitude values in bold.
I don't see anything 'bold' in your mail, but your example tells me what
data you mean.
Here is some untested code using xml.etree.cElementTree:
import xml.etree.cElementTree as ET
tree = ET.parse("thefile.xml")
for tag in tree.getiterator("location"):
print tag.findtext("lat"), tag.findtext("lng")
Thanks Stefan. I tried this but it's not getting into the for block for some
reason.
Maybe the document uses namespace declarations that you forgot to show us?
Stefan
_______________________________________________
XML-SIG maillist - XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig