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



Hi list

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:

# 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="" 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>

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

... (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="" href="http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd">http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd" ID="(null)"
Loaded URL="" 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'.
Loaded URL="" ID="(null)"
Loaded URL="" 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


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