wmo-im / pywcmp

pywcmp provides validation and quality assessment capabilities for the WMO WIS Core Metadata Profile (WCMP)
https://community.wmo.int/activity-areas/wis
Other
9 stars 8 forks source link

XPathEvalError: Undefined namespace prefix #57

Closed maaikelimper closed 2 years ago

maaikelimper commented 2 years ago

Hi running the KPI-analysis over the file de.bafg.grdc.7c706276-caaa-493d-94a4-d2960e83a9ae.xml produces the following error:

/usr/local/lib/python3.7/site-packages/pywcmp-0.4.dev0-py3.7.egg/pywcmp/kpi.py in kpi_004(self)
    332 
    333         LOGGER.debug(f'Testing for temporal information at "{time_period_xpath}"')
--> 334         time_periods = self.exml.xpath(time_period_xpath, namespaces=self.namespaces)
    335 
    336         if len(time_periods) > 0:

src/lxml/etree.pyx in lxml.etree._ElementTree.xpath()

src/lxml/xpath.pxi in lxml.etree.XPathDocumentEvaluator.__call__()

src/lxml/xpath.pxi in lxml.etree._XPathEvaluatorBase._handle_result()

XPathEvalError: Undefined namespace prefix

I suspect this is because this file is missing a definition for the 'gml' namespace

<gmd:MD_Metadata xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd" >

and 'gml' is referenced in the xpath-defintion:

time_period_xpath = '/gmd:MD_Metadata/gmd:identificationInfo//gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod'

maaikelimper commented 2 years ago

https://oai.dwd.de/oai/provider?verb=GetRecord&identifier=de.bafg.grdc.7c706276-caaa-493d-94a4-d2960e83a9ae&metadataPrefix=iso19139