inspire-eu-validation / ets-repository

Repository for Executable Test Suites of the INSPIRE validator (under development)
European Union Public License 1.2
13 stars 25 forks source link

Error message in Test gmlas.b.2 #16

Closed GithubEZNL closed 7 years ago

GithubEZNL commented 7 years ago

We tested the etf WebApp 2.0.0-b160923T1505 with different datasets and for each of the datasets we received the same error message:

XML document 'NLps_nationaleparken.gml': 1:834: cvc-elt.1.a: Cannot find the declaration of element 'gml:FeatureCollection'

and

XML document 'NLps-N20000_20161125.gml': 1:834: cvc-elt.1.a: Cannot find the declaration of element 'gml:FeatureCollection'

I have attached the corresponding gml's.

The gml's were created with HALE 3.0.0.

Cheers, Wim

NLps-N20000_20161125.zip NLps_nationaleparken.zip

cportele commented 7 years ago

I had a look at NLps-N20000_20161125.zip and the problem is that the root element is gml:FeatureCollection, but the xsi:schemaLocation does not declare where the schema documents for the gml namespace can be found. While the GML schema is imported by the PS schema, this is not sufficient for the root element according to the XML Schema rules.

If I change the xsi:schemaLocation attribute to

xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd http://inspire.ec.europa.eu/schemas/ps/4.0 http://inspire.ec.europa.eu/schemas/ps/4.0/ProtectedSites.xsd"

the document is valid. See this test run that I have just created with an updated NLps-N20000_20161125.zip: http://52.57.125.3/etf-webapp/reports/17b15e2d-504c-4aa6-9e1f-79447aee2a0f?lang=en

GithubEZNL commented 7 years ago

Hi Clemens,

Thanks for the quick answer and solution.

The HALE people replied on this:

"the XML Schema validation tools we encountered so far were able to deal with the root element only being defined in an import of the referenced schema. So it surprises me that this would be needed here"

So my question as a user would be what's the difference between former schema validation tools and this one.

Cheers, Wim

cportele commented 7 years ago

Hi Wim,

I think this uses the standard Java XML parser. If I use Xerces-J, a pretty widely used XML parser, I also get:

*** Error: org.xml.sax.SAXParseException; systemId: file:///Users/portele/Downloads/NLps-N20000_20161125.gml; lineNumber: 2; columnNumber: 834; cvc-elt.1: Cannot find the declaration of element 'gml:FeatureCollection'. (file:///Users/portele/Downloads/NLps-N20000_20161125.gml, line 2, column 834)

The error goes away, if I add the GML namespace to xsi:schemaLocation.

So, I do not know what parsers they have been referring to - or with which settings (maybe lax validation is used, not strict validation?), but I get this error with very widely used parsers.

Independent of the tool question, when we analysed XML Schema, Part 1, Clause 4 in OGC in 2005 (mainly 4.2.3 and 4.3.2), the conclusion was that the namespace of the element with the xsi:schemaLocation attribute must be one of the namespaces in that element. For child nodes this is not required as long as they are directly or indirectly imported by one of the schemas referenced from the xsi:schemaLocation attribute.

cc @thorsten-reitz

cportele commented 7 years ago

Closing the issue as no change to the tests seem to be needed. If this requires further discussion, feel free to open the issue again.