History | Edit

For cases where you need to reference the location of a schema file from a remote web location and an Internet connection may not be available, 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 catalog in a custom framework by modifying an XML Schema file.

  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.
    Example:
    Create a new XML file called catalog.xml and save it in your custom framework directory ([OXYGEN_INSTALL_DIR]\frameworks\[CUSTOM_FRAMEWORK_DIR]). The content of the file should look like this:
    <?xml version="1.0"?> 
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
        <uri name="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 custom framework using the Catalogs tab from the Document Type configuration dialog box.

To test the catalog settings, restart Oxygen XML Editor and try to validate a new sample document for your custom framework. There should be no errors.

Example:

The 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 (note that the schema directory needs to be in the same folder as the XML Catalog). The URI element is used by URI resolvers (for example, to resolve a URI reference used in an XSLT stylesheet).