Skip to content

Commit

Permalink
Extract 'type' value from xpath gmd:CI_OnlineResource/gmd:name/gmx:Mi…
Browse files Browse the repository at this point in the history
…meFileType

Note: This is a patch for IDGO
  • Loading branch information
m431m committed Jun 7, 2022
1 parent cee50fb commit ab58bbc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions owslib/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,15 +892,22 @@ def __init__(self, md=None):
self.name = None
self.description = None
self.function = None
self.mimetype = None
else:
val = md.find(util.nspath_eval('gmd:linkage/gmd:URL', namespaces))
self.url = util.testXMLValue(val)

val = md.find(util.nspath_eval('gmd:protocol/gco:CharacterString', namespaces))
self.protocol = util.testXMLValue(val)

val = md.find(util.nspath_eval('gmd:name/gco:CharacterString', namespaces))
self.name = util.testXMLValue(val)
name_elt = md.find(util.nspath_eval('gmd:name', namespaces))
if name_elt is not None and len(name_elt):
child = name_elt[-1] # or `name_elt[0]`, this doesn't should make any difference
# Child node is most often an 'gco:CharacterString' element:
self.name = util.testXMLValue(child)
# But it could be 'gmx:MimeFileType' element too,
# which contains an attribute about mime-type:
self.mimetype = util.testXMLAttribute(child, 'type')

val = md.find(util.nspath_eval('gmd:description/gco:CharacterString', namespaces))
self.description = util.testXMLValue(val)
Expand Down

0 comments on commit ab58bbc

Please sign in to comment.