Configuring XML Catalogs

In the XML sample file for SDF you did not use a xsi:schemaLocation attribute, but instead you let the editor use the schema from the association. However there are cases in which you must refer for instance the location of a schema file from a remote web location and an Internet connection may not be available. In such cases an XML catalog may be used to map the web location to a local file system entry. The following procedure presents an example of using an XML catalogs, by modifying our sdf.xsd XML Schema file from the Example Files Listings.
  1. Create a catalog file that will help the parser locate the schema for validating the XML document. The file must map the location of the schema to a local version of the schema.

    Create a new XML file called catalog.xml and save it into the {oXygen_installation_directory} / frameworks / sdf directory. The content of the file should be:

    <?xml version="1.0"?> 
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
        <system systemId="http://www.oxygenxml.com/SDF/abs.xsd"
                uri="schema/abs.xsd"/>
        <uri name="http://www.oxygenxml.com/SDF/abs.xsd" 
                   uri="schema/abs.xsd"/>
    </catalog>
  2. Add catalog files to your Document Type Association using the Catalogs tab from the Document Type dialog.

To test the catalog settings, restart Oxygen and try to validate a new sample Simple Documentation Framework document. There should be no errors.

The sdf.xsd schema that validates the document refers the other file abs.xsd through an import element:

<xs:import namespace=
 "http://www.oxygenxml.com/sample/documentation/abstracts" 
 schemaLocation="http://www.oxygenxml.com/SDF/abs.xsd"/>

The schemaLocation attribute references the abs.xsd file:

xsi:schemaLocation="http://www.oxygenxml.com/sample/documentation/abstracts
    http://www.oxygenxml.com/SDF/abs.xsd"/>

The catalog mapping is:

http://www.oxygenxml.com/SDF/abs.xsd -> schema/abs.xsd

This means that all the references to http://www.oxygenxml.com/SDF/abs.xsd must be resolved to the abs.xsd file located in the schema directory. The URI element is used by URI resolvers, for example for resolving a URI reference used in an XSLT stylesheet.