<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
    <title>HOWTO</title>
    <subtitle>Create and set up XML catalog files</subtitle>
    <abstract>
        <para>This article explains how to create and set up XML Catalog files.</para>
    </abstract>
    <sect1>
        <title>Introduction</title>
        <para>When Internet access is not available or the Internet connection is slow, the OASIS
            XML catalogs present in the list maintained in the XML Catalog Preferences panel
            (available from menu
            <menuchoice>
                <guimenu>Options</guimenu>
                <guimenuitem>Preferences</guimenuitem>
                <guilabel>XML</guilabel>
                <guilabel>XML Catalog</guilabel>
            </menuchoice>
            ) will be scanned trying to map a remote system ID  or a URI reference 
            pointing to a resource on a remote Web server to a local copy of the same
            resource. System ID references are mapped to local copies during document validation and
            when the content completion assistant computes the proposals presented in the content
            completion window. URI references are mapped to local copies during XSLT transformations
            and XQuery transformations.
        </para>
        <para>XML catalogs make documents machine independent so that they can be shared by many
        developers by modifying only the XML catalog mappings related to the shared documents.</para>
        <para>Any XML catalog that conforms to 
            <ulink url="http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">the OASIS XML Catalogs 1.1 Recommendation</ulink> 
            can be added to the catalogs list available in &lt;oXygen/&gt; from menu 
            <menuchoice>
                <guimenu>Options</guimenu>
                <guimenuitem>Preferences</guimenuitem>
                <guilabel>XML</guilabel>
                <guilabel>XML Catalog</guilabel>
            </menuchoice>
            .</para>
    </sect1>
    <sect1>
        <title>Creating XML Catalog files</title>
        <procedure>
            <title>XML Catalog creation</title>
            <para>Suppose you want to use the XHTML 1.0 Strict schema available at <programlisting>http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd</programlisting></para>
            <step>
                <para>Use a browser to navigate to the schema's location.</para>
            </step>
            <step>
                <para>Copy the schema content in a local file, xhtml1-strict.xsd for example, on your hard drive.</para>
            </step>
            <step>
                <para>In the same folder where you saved the schema file, create a file called catalog.xml, having the following content:</para>
                <para>
                    <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE catalog 
    PUBLIC &quot;-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN&quot;
    &quot;http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd&quot;&gt;
&lt;catalog xmlns=&quot;urn:oasis:names:tc:entity:xmlns:xml:catalog&quot;&gt;
    &lt;rewriteSystem systemIdStartString=&quot;http://www.w3.org/2002/08/xhtml/&quot;
        rewritePrefix=&quot;./&quot;/&gt;   
&lt;/catalog&gt;
                    </programlisting>
                </para>
                <para>The system ID reference or URI reference to a remote resource can also be
                    mapped to a local copy based on the suffix of the reference using the catalog
                    elements <emphasis>systemSuffix</emphasis> and <emphasis>uriSuffix</emphasis>,
                    for example:</para>
                <programlisting>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE catalog 
    PUBLIC &quot;-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN&quot;
    &quot;http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd&quot;&gt;
&lt;catalog xmlns=&quot;urn:oasis:names:tc:entity:xmlns:xml:catalog&quot;&gt;
    &lt;systemSuffix systemIdSuffix=&quot;xhtml1-strict.xsd&quot; 
        uri=&quot;file:///C:/temp/schema/xhtml/xhtml1-strict.xsd&quot;/&gt;
&lt;/catalog&gt;
                </programlisting>
                <para>All the supported catalog elements are described in 
                    <ulink url="http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">the XML catalogs Recommendation</ulink>. 
                </para>
                <para>If you saved the local copy of the XHTML 1.0 Strict schema in a different
                    folder, let's say "C:/temp/", then you have to set the <emphasis>rewritePrefix</emphasis> as
                    <emphasis>rewritePrefix="C:/temp/"</emphasis>. A relative path specified in the  
                    <emphasis>rewritePrefix</emphasis> attribute is resolved relative to the
                    location of the catalog file.</para>
            </step>
        </procedure>
    </sect1>
    <sect1>
        <title>Setting up XML Catalog files</title>
        <procedure>
            <title>Setting up the XML Catalog</title>
            <step>
                <para>Start &lt;oXygen/&gt;.</para>
            </step>
            <step>
                <para>Go to Options -> Preferences -> XML -> XML Catalog option page.</para>
            </step>
            <step>
                <para>Press the New button to add the previously created catalog file to the catalog list.</para>
            </step>
            <step>
                <para>After adding the catalog you must reopen the files already open in which you want
                    to use the catalog for validation, content completion or transformation.</para>
            </step>
        </procedure>
        <para>The new XML catalog settings will take effect in any file opened after the XML
            catalog settings were modified.</para>
        <para> &lt;oXygen/&gt; provides also two document templates for creating XML catalogs. They
            serve as starting points in writing an XML catalog. They are called 
            <emphasis>OASIS XML Catalog 1.0</emphasis> and <emphasis>OASIS XML Catalog 1.1</emphasis> 
            and are available in the list of document templates opened from menu
            <menuchoice>
                <guimenu>File</guimenu>
                <guimenuitem>New from Templates</guimenuitem>
            </menuchoice>
            or from the <emphasis>New from Templates</emphasis> button on the
            <emphasis>File</emphasis> toolbar. 
        </para>
    </sect1>
</article>

