If you're doing this repeatedly, you may want to just delegate to a native XPath implementation. I haven't done much Python, so I can't comment on your choices, but in Ruby I'd simply hand off to libXML using Nokogiri. This approach should be a whole lot faster, but I'd advise benchmarking first because, as I said, I know little about Python.
Best, Sidu. http://sidu.in On Thu, Jul 28, 2011 at 4:01 PM, Kenneth Gonsalves <[email protected]> wrote: > On Thu, 2011-07-28 at 15:33 +0530, Anand Chitipothu wrote: >> > 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' > > thanks - perfect. > -- > regards > Kenneth Gonsalves > > _______________________________________________ > BangPypers mailing list > [email protected] > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
