# XML Catalogs

Komodo can add XML autocompletion support for any XML dialect with a DTD or RelaxNG Schema (XML syntax). This is done by mapping external identifier entries to local copies of the DTD or RelaxNG Schema for that document type using XML Catalogs.

## Using an Existing XML Catalog

Some toolkits bundle DTDs or RelaxNG Schemas with their own XML catalogs. As long as the relative path from the catalog to the .dtd or .rng file is preserved on the local filesystem, you can add support for the dialect by specifying the catalog file in Preferences under SGML/XML Catalogs.

## Creating an XML Catalog

If the DTD or RelaxNG Schema for the dialect does not have a catalog file, you can create one by mapping the external identifiers and URI references in the document's namespace declaration to a local filesystem URI. For example, the XSPF playlist format uses the following namespace declaration:

    <playlist version="1" xmlns="http://xspf.org/ns/0/">

A simple catalog for this XML dialect would look like this:

    <?xml version='1.0'?>
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
    prefer="public">

      <uri name="http://xspf.org/ns/0/" uri="xspf-draft8.rng"/>

    </catalog>

If your documents use the DOCTYPE declaration, you can add support for that in the catalog by using the public and system identifier. For example, XUL uses DOCTYPE declarations like this one:

    <!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
    "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

Komodo's catalog for XUL uses `publicId` and `systemId` in addition to `uri` for the mapping.

    <?xml version='1.0'?>
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">

        <public publicId="-//MOZILLA//DTD XUL V1.0//EN"
                uri="xul.dtd"/>
        <system systemId="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
                uri="xul.dtd"/>
        <uri name="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
             uri="xul.dtd"/>

    </catalog>

## XML Catalog Resources

The XML Catalog specification can be found at:

- http://www.oasis-open.org/committees/entity/spec.html

Examples of XML catalog files can be found in the Komodo installation under:

- <komodo-install-directory>\lib\support\catalogs (Windows)
- /Applications/Komodo.app/Contents/SharedSupport/catalogs/ (OS X)
- <komodo-install-directory>/lib/support/catalogs (Linux)