Re: [xml] Schema validation when using an xml catalog of OGC schemas offline



On Tue, Oct 13, 2015 at 12:37:27PM +0100, Ricardo Filipe Soares Garcia da wrote:
Hi list

  Hi Ricardo,

I'm trying to prepare an XML catalog for working with OGC schemas[1], more
concretely the csw 2.0.2 schema[2].

This catalog's purpose is to use my locally downloaded schemas instead of
fetching them from OGC's repository every time I need to validate something.

when I use xmllint without my catalog, the testing file[3] gets validated
OK, but the process takes a while, because the schemas have to be fetched
over the network:

  okay

# bash
export XML_DEBUG_CATALOG=1

xmllint --load-trace --noout --schema
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/CSW-discovery.xsd
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/examples/capabilities/Capabilities_tC22.xml


... (lots of downloading of schemas happening here)

Loaded
URL="/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/examples/capabilities/Capabilities_tC22.xml"
ID="(null)"
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/examples/capabilities/Capabilities_tC22.xml
validates

Now after downloading the whole opengis schemas, plus the W3C's xlink and
xml schemas into some common directory I have built a catalog file like
this:

<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <rewriteURI uriStartString="http://www.w3.org/";
rewritePrefix="/home/geo2/dev/xmlschemas/w3c/"/>
  <rewriteURI uriStartString="http://schemas.opengis.net/";
rewritePrefix="/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/"/>
</catalog>

  That should work though it might be better to be a bit more selective
i.e. give more focused uriStartString values

When trying this out, xmllint fails saying that it cannot even compile the
schema:

# bash
export XML_CATALOG_FILES=/home/geo2/dev/lixo/test_catalog.xml

xmllint --load-trace --nonet --noout --schema
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/CSW-discovery.xsd
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/examples/capabilities/Capabilities_tC22.xml

  Don't disable net, if you're missing one reference it may fail, it's
better to run with the network and see if it still tries to transfer something

... (everything is fetched from my local repository, but eventually I start
getting errors like this)

Resolve: sysID http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
Resolve URI http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
Using rewriting rule http://schemas.opengis.net/
Loaded URL="http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd";
ID="(null)"
Loaded
URL="/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/gml/3.1.1/smil/smil20-language.xsd"
ID="(null)"
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/gml/3.1.1/smil/smil20-language.xsd:33:
element import: Schemas parser warning : Element '{
http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located
at
'/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/gml/3.1.1/smil/smil20.xsd'
for the namespace 'http://www.w3.org/2001/SMIL20/', since this namespace
was already imported with the schema located at '
http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd'.

  so the same schemas is referenced from 2 different location, that sounds
bad, are they actually identical. If they embedded a copy to be able to
tweak it that may result in the following errors if you don't load their
version.

Loaded
URL="/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/gml/3.1.1/base/temporalReferenceSystems.xsd"
ID="(null)"
Loaded
URL="/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/gml/3.1.1/base/temporalTopology.xsd"
ID="(null)"
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/filter/1.1.0/filter.xsd:31:
element element: Schemas parser error : Element '{
http://www.w3.org/2001/XMLSchema}element': A global element declaration '{
http://www.opengis.net/ogc}_Id' does already exist.
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/filter/1.1.0/filter.xsd:34:
element element: Schemas parser error : Element '{
http://www.w3.org/2001/XMLSchema}element': A global element declaration '{
http://www.opengis.net/ogc}FeatureId' does already exist.

... (and it finally fails with)

WXS schema
/home/geo2/dev/xmlschemas/SCHEMAS_OPENGIS_NET/csw/2.0.2/CSW-discovery.xsd
failed to compile

So it seems that there is something missing from my xml catalog. It is
almost working (no files are being downloaded from the network). I've been
looking at libxml2's docs on catalogs[4], and also the OASIS spec[5], but I
haven't been able to make much more from it.

Thanks for your help

  I'm afraid I don't know, more debug seems needed, try the suggested steps

Daniel

[1] - http://schemas.opengis.net/
[2] -http://schemas.opengis.net/csw/2.0.2/CSW-publication.xsd
[3] -
http://schemas.opengis.net/csw/2.0.2/examples/capabilities/Capabilities_tC22.xml
[4] - http://xmlsoft.org/catalog.html
[5] -
https://www.oasis-open.org/committees/entity/spec-2001-08-06.html#s.public

-- 
___________________________ ___ __
Ricardo Garcia Silva

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
https://mail.gnome.org/mailman/listinfo/xml


-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]