hi,
here is a simplified version of an xml file:
?xml version=1.0 encoding=UTF-8?
gpx
metadata
author
nameCloudMade/name
email id=support domain=cloudmade.com /
link href=http://maps.cloudmade.com;/link
grep or regexp?
-V
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
Using xpath such as:
/gpx/extensions/distance(:text)
?
On Thu, Jul 28, 2011 at 3:20 PM, Venkatraman S venka...@gmail.com wrote:
grep or regexp?
-V
___
BangPypers mailing list
BangPypers@python.org
On Thu, Jul 28, 2011 at 3:20 PM, Venkatraman S venka...@gmail.com wrote:
grep or regexp?
-V
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
can write an Xml parsing query
--
Ramdas S
+91
2011/7/28 Kenneth Gonsalves law...@gmail.com:
hi,
here is a simplified version of an xml file:
?xml version=1.0 encoding=UTF-8?
gpx
metadata
author
nameCloudMade/name
email id=support domain=cloudmade.com /
link
here is a simplified version of an xml file:
?xml version=1.0 encoding=UTF-8?
gpx
metadata
author
nameCloudMade/name
email id=support domain=cloudmade.com /
link href=http://maps.cloudmade.com;/link
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'
You can try beautifulsoup, recommended for python/XML Parsing.
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
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
parsing using minidom is one of the slowest. if you just want to extract the
distance and assuming that it(the tag) will always be consistent, then i
would always suggest regexp. xml parsing is a pain.
___
BangPypers mailing list
BangPypers@python.org
On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S venka...@gmail.com wrote:
parsing using minidom is one of the slowest. if you just want to extract the
distance and assuming that it(the tag) will always be consistent, then i
would always suggest regexp. xml parsing is a pain.
[...]
Strongly
On Fri, Jul 29, 2011 at 1:23 AM, Gora Mohanty g...@mimirtech.com wrote:
On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S venka...@gmail.com
wrote:
parsing using minidom is one of the slowest. if you just want to extract
the
distance and assuming that it(the tag) will always be consistent,
Hi,
check and try pyparsing module... U could do it so simple:)
regards,
joseph
On 7/29/11, Ramdas S ram...@gmail.com wrote:
On Fri, Jul 29, 2011 at 1:23 AM, Gora Mohanty g...@mimirtech.com wrote:
On Thu, Jul 28, 2011 at 10:37 PM, Venkatraman S venka...@gmail.com
wrote:
parsing using
2011/7/28 Venkatraman S venka...@gmail.com:
parsing using minidom is one of the slowest. if you just want to extract the
distance and assuming that it(the tag) will always be consistent, then i
would always suggest regexp. xml parsing is a pain.
regexp is a bad solution to parse xml.
minidom
minidom is the fastest solution if you consider the programmer time
instead of developer time. Minidom is available in standard library,
you don't have to add another dependency and worry about PyPI
downtimes and lxml compilations failures.
FWIW, ElementTree is a part of the standard library
On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu anandol...@gmail.comwrote:
2011/7/28 Venkatraman S venka...@gmail.com:
parsing using minidom is one of the slowest. if you just want to extract
the
distance and assuming that it(the tag) will always be consistent, then i
would always
2011/7/29 Venkatraman S venka...@gmail.com:
On Fri, Jul 29, 2011 at 10:47 AM, Anand Chitipothu
anandol...@gmail.comwrote:
2011/7/28 Venkatraman S venka...@gmail.com:
parsing using minidom is one of the slowest. if you just want to extract
the
distance and assuming that it(the tag) will
2011/7/29 Baishampayan Ghose b.gh...@gmail.com:
minidom is the fastest solution if you consider the programmer time
instead of developer time. Minidom is available in standard library,
you don't have to add another dependency and worry about PyPI
downtimes and lxml compilations failures.
18 matches
Mail list logo