[owslib-users] parsing xml capabilities file

Nick Gart nick.gart at gmail.com
Sun Mar 25 12:21:24 PDT 2012


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 Owslib-users mailing list