[Community] Parsing xml capabilities file in owslib
Nick Gart
nick.gart at gmail.com
Sun Mar 25 23:48:42 EEST 2012
forgot to include the command that generated the first set of output:
wms = WebMapService('http://imselev.cr.usgs.gov/WMS_Capabilities/USGS_EDC_Elev_NED_3/capabilities_1_3_0.xml')
On Sun, Mar 25, 2012 at 1:46 PM, Nick Gart <nick.gart at gmail.com> wrote:
> (originally sent to owslib-users but that list seems to not be active)
>
>
> I am trying to create a WebMapService from this url:
> http://imselev.cr.usgs.gov/WMS_Capabilities/USGS_EDC_Elev_NED_3/capabilities_1_3_0.xml
>
> but it doesn't seem to be parsing correctly:
>
>
> File "<stdin>", line 1, in <module>
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 86, in __init__
> self._buildMetadata(parse_remote_metadata)
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 101, in _buildMetadata
> self.identification=ServiceIdentification(serviceelem, self.version)
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 267, in __init__
> self.type = testXMLValue(self._root.find('Name'))
> AttributeError: 'NoneType' object has no attribute 'find'
>
>
> Since the URl isn't a CGI link, I tried pulling the XML and feeding
> that in as XML too:
>
>
>>>> capurl = urllib2.urlopen('http://imselev.cr.usgs.gov/WMS_Capabilities/USGS_EDC_Elev_NED_3/capabilities_1_3_0.xml').readlines()
>>>>capstring = "".join(capurl)
>>>> wms = WebMapService('',xml=capstring)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 86, in __init__
> self._buildMetadata(parse_remote_metadata)
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 101, in _buildMetadata
> self.identification=ServiceIdentification(serviceelem, self.version)
> File "/Library/Python/2.5/site-packages/OWSLib-0.4.0-py2.5.egg/owslib/wms.py",
> line 267, in __init__
> self.type = testXMLValue(self._root.find('Name'))
> AttributeError: 'NoneType' object has no attribute 'find'
>
>
> Am I going about this properly?
> Thanks
More information about the Community
mailing list