Skip to content

Commit a713c62

Browse files
authored
Merge pull request #947 from pvgenuchten/anchor-in-identifier
adds support for gmx:anchor in gmd:identifier
2 parents 40b9fe0 + 3824231 commit a713c62

File tree

3 files changed

+653
-3
lines changed

3 files changed

+653
-3
lines changed

owslib/iso.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,23 +407,48 @@ def __init__(self, md=None, identtype=None):
407407

408408
self.uricode = []
409409
_values = md.findall(util.nspath_eval(
410+
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString',
411+
namespaces))
412+
_values += md.findall(util.nspath_eval(
410413
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco:CharacterString',
411414
namespaces))
415+
for i in _values:
416+
val = util.testXMLValue(i)
417+
if val not in [None,'']:
418+
self.uricode.append(val)
419+
420+
_values = md.findall(util.nspath_eval(
421+
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gmx:Anchor',
422+
namespaces))
412423
_values += md.findall(util.nspath_eval(
413-
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString',
424+
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gmx:Anchor',
414425
namespaces))
415426
for i in _values:
416427
val = util.testXMLValue(i)
417-
if val is not None:
428+
val1 = i.attrib.get(util.nspath_eval('xlink:href', namespaces))
429+
if val1 not in [None,'']:
430+
self.uricode.append(val1)
431+
elif val not in [None,'']:
418432
self.uricode.append(val)
433+
419434

420435
self.uricodespace = []
421436
for i in md.findall(util.nspath_eval(
422437
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gco:CharacterString',
423438
namespaces)):
424439
val = util.testXMLValue(i)
425-
if val is not None:
440+
if val not in [None,'']:
426441
self.uricodespace.append(val)
442+
for i in md.findall(util.nspath_eval(
443+
'gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:codeSpace/gmx:Anchor',
444+
namespaces)):
445+
val = util.testXMLValue(i)
446+
val1 = i.attrib.get(util.nspath_eval('xlink:href', namespaces))
447+
if val1 not in [None,'']:
448+
self.uricode.append(val1)
449+
elif val not in [None,'']:
450+
self.uricode.append(val)
451+
427452

428453
self.date = []
429454
self.datetype = []

0 commit comments

Comments
 (0)