XML Schema Validation

264 views
Skip to first unread message

Just van den Broecke

unread,
Nov 4, 2010, 9:39:53 AM11/4/10
to inspire-f...@googlegroups.com
During my development of the XSLT transformations I do schema validation
of the generated GML. Up to now I have used a simple Java class that
calls the Java SE SAX parser with all validation flags set. This seems
to work, imported schemas are downloaded through HTTP etc.

But I wanted a simple commandline alternative and found a standard Unix
tool xmllint (http://infohost.nmt.edu/tcc/help/xml/lint.html based on
libxml2). Somehow xmllint does not recognize schemaLocation, so the
schema must be passed like:

xmllint --noout --schema HydroPhysicalWaters.xsd hydrography-surfaces.gml

I can see that all further imports are downloaded, but then I get an
error that the INSPIRE XSD itself failed to compile because of GML base
schema errors:

http://schemas.opengis.net/gml/3.2.1/geometryBasic0d1d.xsd:123: element
complexType: Schemas parser error : local list type: A type, derived by
list or union, must have the simple ur-type definition as base type, not
'{http://www.opengis.net/gml/3.2}doubleList'.
http://schemas.opengis.net/gml/3.2.1/valueObjects.xsd:159: element
complexType: Schemas parser error : local list type: A type, derived by
list or union, must have the simple ur-type definition as base type, not
'{http://www.opengis.net/gml/3.2}NameOrNilReasonList'.
http://schemas.opengis.net/gml/3.2.1/valueObjects.xsd:173: element
complexType: Schemas parser error : local list type: A type, derived by
list or union, must have the simple ur-type definition as base type, not
'{http://www.opengis.net/gml/3.2}doubleOrNilReasonList'.
WXS schema
../../../../webapps/deegree3/src/main/webapp/WEB-INF/workspace/schemas/inspire/annex1/HydroPhysicalWaters.xsd
failed to compile

Any idea, or is this the "DeprecatedTypes" issue ? Or do you have other
commandline XML validator suggestions ?

best,

Just

Andreas Schmitz

unread,
Nov 4, 2010, 10:17:11 AM11/4/10
to inspire-f...@googlegroups.com
Just van den Broecke wrote:

Hi,

> During my development of the XSLT transformations I do schema validation
> of the generated GML. Up to now I have used a simple Java class that
> calls the Java SE SAX parser with all validation flags set. This seems
> to work, imported schemas are downloaded through HTTP etc.
>
> But I wanted a simple commandline alternative and found a standard Unix
> tool xmllint (http://infohost.nmt.edu/tcc/help/xml/lint.html based on
> libxml2). Somehow xmllint does not recognize schemaLocation, so the
> schema must be passed like:
>
> xmllint --noout --schema HydroPhysicalWaters.xsd hydrography-surfaces.gml
>
> I can see that all further imports are downloaded, but then I get an
> error that the INSPIRE XSD itself failed to compile because of GML base
> schema errors:

yes, we also had trouble with xmllint. We did not find a solution to the
problem yet. For validation I do not know of any cmdline tool that can
cope with the GML schemas, so my guess is that the java class is your
best bet. Combine it with a simple bash alias:

alias validatexml="java -jar validator.jar"

and you have sort of a cmdline tool:

validatexml <options>

> Any idea, or is this the "DeprecatedTypes" issue ? Or do you have other
> commandline XML validator suggestions ?

I don't have a specific idea of what goes wrong (and I don't know about
the DeprecatedTypes issue), but I don't think we've ever gotten so
far. IIRC we had the problem of the GML schemas loaded multiple times,
resulting in duplicate types/elements etc. So maybe one can fix the
problem using some magic switches? I didn't find any, though, but if
there's progress one can always hope for future releases.

Best regards, Andreas
--
l a t / l o n GmbH
Aennchenstrasse 19 53177 Bonn, Germany
phone ++49 +228 18496-0 fax ++49 +228 18496-29
http://www.lat-lon.de http://www.deegree.org

* * * * * * * * * * * * * * * * * * * * * * * * * * * *
deegree day 2010
http://deegreeday.deegree.org
* * * * * * * * * * * * * * * * * * * * * * * * * * * *

signature.asc

Just van den Broecke

unread,
Nov 4, 2010, 10:31:15 AM11/4/10
to inspire-f...@googlegroups.com
Hi Andreas,

For now I had already taken somewhat your suggested solution using my
Validate class with some commandlining:

http://code.google.com/p/inspire-foss/source/browse/#svn/trunk/tools/validator

best,

Just

Reply all
Reply to author
Forward
0 new messages