2011/7/28 Kenneth Gonsalves <[email protected]>:
> hi,
>
> here is a simplified version of an xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <gpx >
> <metadata>
> <author>
> <name>CloudMade</name>
> <email id="support" domain="cloudmade.com" />
> <link href="http://maps.cloudmade.com"></link>
> </author>
> <copyright author="CloudMade">
> <license>http://cloudmade.com/faq#license</license>
> </copyright>
> <time>2011-07-28T07:04:01</time>
> </metadata>
> <extensions>
> <distance>1489</distance>
> <time>344</time>
> <start>Sägerstraße</start>
> <end>Im Gisinger Feld</end>
> </extensions>
> </gpx>
>
> I want to get the value of the distance element - 1489. What is the
> simplest way of doing this?
>>> from xml.dom import minidom
>>> dom = minidom.parseString(x)
>>> dom.getElementsByTagName("distance")[0].childNodes[0].nodeValue
u'1489'
Anand
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers