Please enable JavaScript to view this site.

Altova MapForce Server 2021 

» No topics above this level «

Catalog Files

Scroll Home Prev Top Next More

MapForce Server supports a subset of the OASIS XML catalogs mechanism (https://www.oasis-open.org/committees/entity/spec-2001-08-06.html). The catalog mechanism enables MapForce Server to retrieve commonly used DTDs and XML schemas (as well as stylesheets and other files) from local folders instead of resolving them from a public URI. This increases the overall processing speed, enables you to work offline (that is, not connected to a network), and improves the portability of documents.

 

How catalogs work

Catalogs are commonly used to redirect a public DTD or schema reference to a local URI (typically, a local file path). To achieve this, a catalog file in XML format defines a mapping between the public schema URI and a local URI. Whenever MapForce Server parses an XML document, it looks for the schema URI (or public or system identifier of a DTD, if applicable) inside the catalog file first. If a mapping is found in the catalog file, then that reference will be used and the schema will be read from a local file. If no mapping is found in the catalog file, then the URI of the XML document will be resolved as is.

 

For example, let's suppose that the following XML file must be processed by MapForce Server.

 

<?xml version="1.0" encoding="UTF-8"?>
<Articles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Articles.xsd">
  <Article>
    <Number>1</Number>
    <Name>T-Shirt</Name>
    <SinglePrice>25</SinglePrice>
  </Article>
</Articles>

 

Let's also suppose that a catalog.xml file exists somewhere in a local directory (of which MapForce Server is aware, as further discussed below), and it contains the following line:

 

<catalog>

 <!--...-->
<uri name="http://www.w3.org/2001/XMLSchema-instance.xsd" uri="files/XMLSchema-instance.xsd"/>
<!--...-->
</catalog>

 

On parsing the XML file, MapForce Server will detect a match for the schema reference http://www.w3.org/2001/XMLSchema-instance.xsd in the catalog file. Consequently, the schema will be loaded from files/XMLSchema-instance.xsd (which is a local path relative to the catalog file). If no mapping were found in the catalog file, then the schema would be loaded from http://www.w3.org/2001/XMLSchema-instance.

 

Root catalog

When MapForce Server starts, it loads a file called RootCatalog.xml from the %ProgramFilesFolder%\Altova\MapForceServer2021\etc directory. RootCatalog.xml contains a list of catalog files, each in a nextCatalog element. These catalog files are looked up and the URIs in them are resolved by MapForce Server according to the mappings specified in them.

 

<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:spy="http://www.altova.com/catalog_ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog
Catalog.xsd">
  <nextCatalog catalog="CustomCatalog.xml"/>
  <nextCatalog catalog="CoreCatalog.xml"/>
  <!-- Include all catalogs under common schemas folder on the first directory level -->
  <nextCatalog spy:recurseFrom="Schemas" catalog="catalog.xml" spy:depth="1"/>
</catalog>

RootCatalog.xml

In the listing above, notice that the following catalogs are listed for lookup:

 

CustomCatalog.xml is the file in which you can create your own mappings. This file is in the %ProgramFilesFolder%\Altova\MapForceServer2021\etc directory. You can add mappings to CustomCatalog.xml for any custom schema if that is not already addressed by the Altova-configured catalog files (see the next bullets).

CoreCatalog.xml contains certain Altova-specific mappings for locating schemas. This file is also in the %ProgramFilesFolder%\Altova\MapForceServer2021\etc directory.

Multiple catalog.xml files from the Schemas directory relative to the RootCatalog.xml file. Each catalog.xml file is inside the directory of a specific schema (such as SVG, DITA, DocBook, WSDL, and so on), and each maps public and/or system identifiers to URIs that point to locally saved copies of the respective schemas.

 

Note the following:

 

If you intend to modify the CustomCatalog.xml, use only the Supported elements. Also, make sure not to duplicate the already existing mappings, as this could lead to errors.

 

Supported elements

When creating entries in CustomCatalog.xml, use only the elements listed below. Other elements of the OASIS XML catalog specification are not supported.

 

Element

Attributes

Example

public

publicId specifies the public identifier of a resource

uri specifies a URI reference (for example, a relative path to a local file)

<public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="files/XMLSchema.dtd"/>

system

systemId specifies the system identifier of a resource

uri specifies a URI reference (for example, a relative path to a local file)

<system systemId="http://www.w3.org/2009/XMLSchema/datatypes.dtd" uri="files/datatypes.dtd"/>

uri

name specifies a URI reference

uri specifies an alternate URI reference (for example, a relative path to a local file)

<uri name="http://www.w3.org/2009/XMLSchema/XMLSchema.xsd" uri="files/XMLSchema.xsd"/>

rewriteURI

uriStartString specifies the starting part of a URI to rewrite

uri specifies the replacement string (for example, a relative path to a local directory)

<rewriteURI uriStartString='http://www.altova.com/schemas/svg/' rewritePrefix='files/'/>

rewriteSystem

systemIdStartString specifies the starting part of a system identifier to rewrite

rewritePrefix specifies the replacement string (for example, a relative path to a local directory)

<rewriteSystem systemIdStartString='http://www.altova.com/schemas/svg/' rewritePrefix='files/'/>

 

The public, system, and uri elements can also take the xml:base attribute, which is used to specify a base URI with respect to which a relative URI would be resolved. For more information, see the XML Catalogs specification (http://www.oasis-open.org/committees/entity/spec-2001-08-06.html).

© 2020 Altova GmbH