Skip to content

Commit

Permalink
Merge pull request #947 from pvgenuchten/anchor-in-identifier
Browse files Browse the repository at this point in the history
adds support for gmx:anchor in gmd:identifier
  • Loading branch information
geographika authored Oct 19, 2024
2 parents 40b9fe0 + 3824231 commit a713c62
Show file tree
Hide file tree
Showing 3 changed files with 653 additions and 3 deletions.
31 changes: 28 additions & 3 deletions owslib/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,23 +407,48 @@ def __init__(self, md=None, identtype=None):

self.uricode = []
_values = md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString',
namespaces))
_values += md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco:CharacterString',
namespaces))
for i in _values:
val = util.testXMLValue(i)
if val not in [None,'']:
self.uricode.append(val)

_values = md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gmx:Anchor',
namespaces))
_values += md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString',
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gmx:Anchor',
namespaces))
for i in _values:
val = util.testXMLValue(i)
if val is not None:
val1 = i.attrib.get(util.nspath_eval('xlink:href', namespaces))
if val1 not in [None,'']:
self.uricode.append(val1)
elif val not in [None,'']:
self.uricode.append(val)


self.uricodespace = []
for i in md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString',
namespaces)):
val = util.testXMLValue(i)
if val is not None:
if val not in [None,'']:
self.uricodespace.append(val)
for i in md.findall(util.nspath_eval(
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gmx:Anchor',
namespaces)):
val = util.testXMLValue(i)
val1 = i.attrib.get(util.nspath_eval('xlink:href', namespaces))
if val1 not in [None,'']:
self.uricode.append(val1)
elif val not in [None,'']:
self.uricode.append(val)


self.date = []
self.datetype = []
Expand Down
Loading

0 comments on commit a713c62

Please sign in to comment.