XSD, catalog and PUBLIC IDs

Hello, The XML Schema specification does not provide a public ID mechanism for associating an XML Schema with a unique ID independent of the storage location. You have to use the system ID mechanism to map your XML Schemas references to XSD files through an XML catalog. That means a DOCTYPE declaration that associates an ID with an XSD file <!DOCTYPE be PUBLIC "-//Kluwer/XSD BE-JUR-OFF-XML//NL" "be-jur-off.xsd"> does not make sense. Only a DTD can be associated in this way. All your XML documents validated against XML Schemas should look like: <?xml version="1.0" encoding="US-ASCII"?> <be xsi:noNamespaceSchemaLocation="file:/C:/Daidalos/PuMaSVN/relax/trunk/DTDs/be-jur-off/be-jur-off.xsd" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "> ... </be> or should be associated by default with the XML Schema set in an oXygen document type as you can read in the validation error message that you posted. You define a document type from menu Options -> Preferences -> Document Type Association: http://www.oxygenxml.com/doc/ug-standalone/preferences-document-type-associa... http://www.oxygenxml.com/doc/ug-standalone/author-predefined-doc-types.html http://www.oxygenxml.com/doc/ug-standalone/dg_complex_customization_tutorial... The public ID mechanism available for DTDs was defined in the W3C XML specification where DTDs are also defined and was inherited from SGML. XML Schema was defined in a different specification (the W3C XML Schema specification) which defines only the system ID mechanism. Regards, Sorin Theun Fleer wrote:
But when I directly point to the xsd (Document > XML Document > Associate Schema) I get this
<?xml version="1.0" encoding="US-ASCII"?> <!--<!DOCTYPE be PUBLIC "-//Kluwer/XSD BE-JUR-OFF-XML//NL" "be-jur-off.xsd">--> <be xsi:noNamespaceSchemaLocation="file:/C:/Daidalos/PuMaSVN/relax/trunk/DTDs/be-jur-off/be-jur-off.xsd"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance> "> ... </be>
This xml-instance validates just fine. Note that I had to comment the DOCTYPE declaration.
What's the problem with my setup of catalog and PUBLIC IDs?

Theun Fleer wrote:
What's the problem with my setup of catalog and PUBLIC IDs?
As Sorin said, you can only use a DOCTYPE declaration to point to a DTD. However, you can point to an XSD schema through a catalog but you can't use an SGML-style PUBLIC ID to do it, you must use an absolute URI (e.g., "http://www.example.com/doctypes/schemas/myschema/myschema.xsd"). This is the because the schemaLocation attributes are defined as mapping URIs to URIs and a PUBLIC ID is not a URI syntactically. If you are using the Xerxes parser (which is what Oxygen uses by default), in your catalog, use system entries to map the absolute URI to a local version of it. This is because Xerces implements the schemaLocation= and noNamespaceSchemaLocation= attributes as though they were system identifiers and so uses system lookups against your catalog. If you are using (hopefully) any other parser you would use URI entries in the catalog to map the absolute URIs to local files. Also, as Sorin said, you can map namespaces to schemas, assuming your documents use namespaces. Cheers, Eliot -- Eliot Kimber Senior Solutions Architect "Bringing Strategy, Content, and Technology Together" Main: 610.631.6770 www.reallysi.com www.rsuitecms.com

hi Sorin and Eliot thank for your respones!
As Sorin said, you can only use a DOCTYPE declaration to point to a DTD.
However, you can point to an XSD schema through a catalog but you can't use an SGML-style PUBLIC ID to do it, you must use an absolute URI (e.g., "http://www.example.com/doctypes/schemas/myschema/myschema.xsd"). This is the because the schemaLocation attributes are defined as mapping URIs to URIs and a PUBLIC ID is not a URI syntactically.
If you are using the Xerxes parser (which is what Oxygen uses by default), in your catalog, use system entries to map the absolute URI to a local version of it. This is because Xerces implements the schemaLocation= and noNamespaceSchemaLocation= attributes as
So, I changed my @xsi:schemaLocation to an URI <?xml version="1.0" encoding="US-ASCII"?> <be xsi:noNamespaceSchemaLocation="http://www.daidalos/nl/puma/be-jur-off.xs d" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> ... </be> though they were system identifiers
and so uses system lookups against your catalog.
and I changed my catalog to <system systemId="http://wwww.daidalos.nl/puma/be-jur-off.xsd" uri="be-jur-off/be-jur-off.xsd"/> <system systemId="http://wwww.daidalos.nl/puma/be-jur-com.xsd" uri="be-jur-com/be-jur-com.xsd"/> for Xerces and <uri name="http://wwww.kluwer.nl/puma/be-jur-off.xsd" uri="be-jur-off/be-jur-off.xsd"/> <uri name="http://wwww.kluwer.nl/puma/be-jur-com.xsd" uri="be-jur-com/be-jur-com.xsd"/> for other parsers and in oXygen / Xerxes it works like a charm; catalog is resolved and validation is OK. I will have to do some testing for others parsers we use in the project. Thanks again! groet Theun Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27 Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 www.daidalos.nl KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
participants (3)
-
Eliot Kimber
-
Sorin Ristache
-
Theun Fleer