From 65247fe16115f9bb1144f51f4f970c7294c7c222 Mon Sep 17 00:00:00 2001 From: "daniel.navarro" Date: Thu, 30 Jan 2020 15:47:41 +0100 Subject: [PATCH 1/3] Fixed schema validation when schemaLocation is missing --- metadata/1.3/xml/ets-md-xml-bsxets.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/metadata/1.3/xml/ets-md-xml-bsxets.xml b/metadata/1.3/xml/ets-md-xml-bsxets.xml index b525dd248..faff12d7d 100644 --- a/metadata/1.3/xml/ets-md-xml-bsxets.xml +++ b/metadata/1.3/xml/ets-md-xml-bsxets.xml @@ -8,11 +8,11 @@ This is a draft version. It has limitations and is expected to contain errors. Please report any issues or problems in GitHub.

Source: Conformance Class 'XML encoding of ISO 19115/19119 metadata']]> ../../../inspire-md-bsxets.xq - 0.2.0 + 0.2.1 interactive instruments GmbH 2016-08-30T00:00:00Z interactive instruments GmbH - 2017-02-21T17:00:00Z + 2020-01-30T15:40:00Z @@ -98,9 +98,11 @@ let $messages := else for $file in $db return - if ($file/element()/@xsi:schemaLocation) then + if ($file/element()) then let $result := - if ( contains($file/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($file/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then + if (not($file/element()/@xsi:schemaLocation)) then + try{ validate:xsd($file, 'http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd') } catch * { $err:description } + else if ( contains($file/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($file/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then try{ validate:xsd($file, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else try{ validate:xsd($file) } catch * { $err:description } @@ -112,7 +114,9 @@ let $messages := for $record in $records let $rid := $record/gmd:fileIdentifier/*/text() let $result := - if ( contains($record/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($record/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then + if (not($file/element()/@xsi:schemaLocation)) then + try{ validate:xsd($file, 'http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd') } catch * { $err:description } + else if ( contains($record/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($record/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then try{ validate:xsd($record, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else try{ validate:xsd($record) } catch * { $err:description } From fd84e21b17d1f3418a8771301231f95bce2ecfd5 Mon Sep 17 00:00:00 2001 From: "daniel.navarro" Date: Thu, 30 Jan 2020 16:55:13 +0100 Subject: [PATCH 2/3] Modify fixed schema to avoid redirection problems --- metadata/1.3/xml/ets-md-xml-bsxets.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata/1.3/xml/ets-md-xml-bsxets.xml b/metadata/1.3/xml/ets-md-xml-bsxets.xml index faff12d7d..01414e686 100644 --- a/metadata/1.3/xml/ets-md-xml-bsxets.xml +++ b/metadata/1.3/xml/ets-md-xml-bsxets.xml @@ -101,7 +101,7 @@ let $messages := if ($file/element()) then let $result := if (not($file/element()/@xsi:schemaLocation)) then - try{ validate:xsd($file, 'http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd') } catch * { $err:description } + try{ validate:xsd($file, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else if ( contains($file/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($file/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then try{ validate:xsd($file, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else @@ -115,7 +115,7 @@ let $messages := let $rid := $record/gmd:fileIdentifier/*/text() let $result := if (not($file/element()/@xsi:schemaLocation)) then - try{ validate:xsd($file, 'http://schemas.opengis.net/csw/2.0.2/profiles/apiso/1.0.0/apiso.xsd') } catch * { $err:description } + try{ validate:xsd($file, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else if ( contains($record/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($record/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then try{ validate:xsd($record, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else From 259745de5ce842f27a16cd83976c8e8d81f94d00 Mon Sep 17 00:00:00 2001 From: "daniel.navarro" Date: Thu, 30 Jan 2020 17:09:44 +0100 Subject: [PATCH 3/3] Fixed xpath --- metadata/1.3/xml/ets-md-xml-bsxets.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata/1.3/xml/ets-md-xml-bsxets.xml b/metadata/1.3/xml/ets-md-xml-bsxets.xml index 01414e686..0c4e01c0a 100644 --- a/metadata/1.3/xml/ets-md-xml-bsxets.xml +++ b/metadata/1.3/xml/ets-md-xml-bsxets.xml @@ -114,7 +114,7 @@ let $messages := for $record in $records let $rid := $record/gmd:fileIdentifier/*/text() let $result := - if (not($file/element()/@xsi:schemaLocation)) then + if (not($record/element()/@xsi:schemaLocation)) then try{ validate:xsd($file, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description } else if ( contains($record/element()/@xsi:schemaLocation, 'http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/gmd/gmd.xsd') or contains($record/element()/@xsi:schemaLocation, 'http://www.isotc211.org/2005/gmd/gmd.xsd')) then try{ validate:xsd($record, 'https://inspire.ec.europa.eu/draft-schemas/inspire-md-schemas-temp/apiso-inspire/apiso-inspire.xsd') } catch * { $err:description }