It is sometimes necessary to specify an alternate schema file for a particular namespace. For example, when one of the NIEM subset schemas must be modified. Directly altering the NIEM subset schema is not a good idea because it may be regenerated during the development process. This would require the modifications to be reapplied each time a new NIEM subset is generated. When this is the case, a new version of the schema that must be modified should be stored outside of the NIEM subset directory.
One way to specify an alternate schema location, without modifying the existing schemas, is through an XML catalog. With a catalog, a different schema location can be assigned, for a particular namespace, that will overrule import statements for that namespace.
As an example, refer to the FarmersMarket IEPD. This IEPD has an alternate schema for the GML namespace that should be used whenever EXI is used to encode the FarmersMarket instances. FarmersMarket-IEPD/exi- xsd/gml.xsd is a subset of the GML schemas and has only the GML components needed for the FarmersMarket IEPD as well as modifications. FarmersMarket-IEPD/exi-xsd/exi-xml-catalog.xml is a simple XML catalog file that can be used point occurences of the GML namespace to gml.xsd. This is done by using the following element:
<uri name="http://www.opengis.net/gml/3.2" uri=</font>"./gml.xsd"/>
The name attribute is the namespace as it appears in the IEPD schemas. The uri attribute is the relative path of the schema file.
Step 1: Create, or determine, the alternate schema to be assgned to the namespace
Step 2: Create a catalog XML instance
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog prefer="public" xmlns="urn:oasis:namestc:en:tity:xmlns:xml:catalog">
</catalog>
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog prefer="public" xmlns="urn:oasis:namestc:en:tity:xmlns:xml:catalog">
<uri name="http://www.opengis.net/gml/3.2" uri=</font>"./gml.xsd"/>
</catalog>
</p>
This catalog file can now be used to redirect any occurrence of the GML namespace (“http://www.opengis.net/gml/3.2”) to the alternate schema.
Step 1: Locate CustomCatalogs.xml and open in a text editor
Step 2: Add nextCatalog element to CustomCatalogs.xml, as shown in the example below.
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v5 beta 1 U (http://www.xmlspy.com) by Vladislav Gavrielov (Altova) -->
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog
Catalog.xsd">
<nextCatalog catalog="C:\GTRI\NIEM\FarmersMarket-IEPD\exi-xsd\exi-xml-catalog.xml"</u>/>
</catalog>
Step 3: Start XMLSpy
Step 4: Import IEPD into XMLSpy
Step 5: Verify that the alternate schema is loaded
</ol> Note: This process will redirect the namespace schema location for all schemas used in XMLSpy, not just those in this example.