rendered paste body>>> from xml.dom.ext.reader import Sax2
>>>
>>> # create Reader object
... reader = Sax2.Reader()
>>>
>>> # parse the document
...
>>> doc = reader.fromStream(open("/tmp/geocaching.loc").read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/_xmlplus/dom/ext/reader/Sax2.py", line 371, in fromStream
s = saxutils.prepare_input_source(stream)
File "/usr/lib/python2.5/site-packages/_xmlplus/sax/saxutils.py", line 523, in prepare_input_source
f = urllib2.urlopen(source.getSystemId())
File "/usr/lib/python2.5/urllib2.py", line 121, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.5/urllib2.py", line 366, in open
protocol = req.get_type()
File "/usr/lib/python2.5/urllib2.py", line 241, in get_type
raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: ?xml version="1.0" encoding="UTF-8"?>
<loc version="1.0" src="Groundspeak">
<waypoint>
<name id="GCJPKC"><![CDATA[Tucked Away by Deke Rivers]]></name>
<coord lat="61.3074833333333" lon="-149.566166666667"/>
<type>Geocache</type>
<link text="Cache Details">http://www.geocaching.com/seek/cache_details.aspx?wp=GCJPKC</link>
</waypoint>
</loc