Validation of no-namespace Schema-based Document

I'm trying to figure out how or if its possible to validate a schema-based document against a schema where the system location is a relative URI resolved through a catalog. Here's my document element: <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="simpletest_nons.xsd"> This document validates when it's in the same directory as the schema. Here is my catalog: <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> <system systemId="simpletest_nons.xsd" uri="simpletest_nons.xsd" /> <uri name="simpletest_nons.xsd" uri="simpletest_nons.xsd" /> <uri name="urn:simpletest.gidi.org" uri="simpletest.xsd" /> </catalog> When I try to validate the above document stored in a location separate from the schema, validation fails with messages to the effect that it can't find the schema, with an effective URI that reflects the location of the document. Actually I get the same sort of failure for a namespaced document valid against a namespace-governing schema, e.g.: <document xmlns="urn:simpletest.gidi.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:simpletest.gidi.org simpletest.xsd"> Is it possible to use catalogs to remap non-absolute URIs in this way or must I use absolute URIs for the schema location value? Thanks, E. -- Eliot Kimber Senior Solutions Architect "Bringing Strategy, Content, and Technology Together" Main: 610.631.6770 www.reallysi.com www.rsuitecms.com

Eliot Kimber wrote:
Is it possible to use catalogs to remap non-absolute URIs in this way or must I use absolute URIs for the schema location value?
Follow up: I verified that an absolute URI is resolved via a catalog for both namespace and no-namespace cases, e.g.: xsi:noNamespaceSchemaLocation="urn:schema:simpletest_nons.xsd" Mapped thus: <system systemId="urn:schema:simpletest_nons.xsd" uri="simpletest_nons.xsd" /> I suspect this is simply representative of how Xerces (broken) implementation of schema location resolution works. [It is broken because it uses SYSTEM resolution calls to resolve schema locations, rather than URI resolution calls. I reported a bug a while ago and the response was "we're not going to fix it, it's too deep in the code". I looked at the code and concur that it would be a non-trivial fix. Nevertheless, it's still wrong.] Cheers, E. -- Eliot Kimber Senior Solutions Architect "Bringing Strategy, Content, and Technology Together" Main: 610.631.6770 www.reallysi.com www.rsuitecms.com

Hi Eliot, The problem with the system mappings versus uri mappings is a problem in SAX not in Xerces. At the XNI level (Xerces Native Interface) it is possible to identify that a schema location needs to be resolved and to get its namespace and try to pass that through a uri mapping. We plan to update oXygen to use Xerces at XNI level and thus to add support for mapping namespaces through the catalog uri entries to schema locations. Best Regards, George --------------------------------------------------------------------- George Cristian Bina - http://aboutxml.blogspot.com/ <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Eliot Kimber wrote:
Eliot Kimber wrote:
Is it possible to use catalogs to remap non-absolute URIs in this way or must I use absolute URIs for the schema location value?
Follow up: I verified that an absolute URI is resolved via a catalog for both namespace and no-namespace cases, e.g.:
xsi:noNamespaceSchemaLocation="urn:schema:simpletest_nons.xsd"
Mapped thus:
<system systemId="urn:schema:simpletest_nons.xsd" uri="simpletest_nons.xsd" />
I suspect this is simply representative of how Xerces (broken) implementation of schema location resolution works. [It is broken because it uses SYSTEM resolution calls to resolve schema locations, rather than URI resolution calls. I reported a bug a while ago and the response was "we're not going to fix it, it's too deep in the code". I looked at the code and concur that it would be a non-trivial fix. Nevertheless, it's still wrong.]
Cheers,
E.

Hi Eliot, oXygen supports XML Catalogs 1.1 and you can resolve the schema based on its suffix, so you can have something like: <systemSuffix systemIdSuffix="simpletest_nons.xsd" uri="simpletest_nons.xsd"/> that should solve all schema locations ending in simpletest_nons.xsd to the simpletest_nons.xsd from the same folder as your catalog file. Best Regards, George --------------------------------------------------------------------- George Cristian Bina - http://aboutxml.blogspot.com/ <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Eliot Kimber wrote:
I'm trying to figure out how or if its possible to validate a schema-based document against a schema where the system location is a relative URI resolved through a catalog.
Here's my document element:
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="simpletest_nons.xsd">
This document validates when it's in the same directory as the schema.
Here is my catalog:
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> <system systemId="simpletest_nons.xsd" uri="simpletest_nons.xsd" /> <uri name="simpletest_nons.xsd" uri="simpletest_nons.xsd" /> <uri name="urn:simpletest.gidi.org" uri="simpletest.xsd" /> </catalog>
When I try to validate the above document stored in a location separate from the schema, validation fails with messages to the effect that it can't find the schema, with an effective URI that reflects the location of the document.
Actually I get the same sort of failure for a namespaced document valid against a namespace-governing schema, e.g.:
<document xmlns="urn:simpletest.gidi.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:simpletest.gidi.org simpletest.xsd">
Is it possible to use catalogs to remap non-absolute URIs in this way or must I use absolute URIs for the schema location value?
Thanks,
E.
participants (2)
-
Eliot Kimber
-
George Cristian Bina