blob: 828484fcc1775aaf3c470fa2a3d11bc1e93c8c64 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--Arbortext, Inc., 1988-2005, v.4002-->
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<?Pub Inc?>
<task id="txmlcat" xml:lang="en-us">
<title>Adding entries to the XML Catalog</title>
<titlealts>
<searchtitle>Adding entries to the XML Catalog</searchtitle>
</titlealts>
<shortdesc>An XML Catalog entry contains two parts - a Key (which represents
a DTD or XML schema) and a Uniform Resource Identifier (URI) (which contains
information about a DTD or XML schema's location). You can place the Key in
an XML file. When the XML processor encounters it, it will use the XML Catalog
entry to find the location of the DTD or XML schema associated with the Key</shortdesc>
<prolog><metadata>
<keywords><indexterm>XML catalog<indexterm>adding entries</indexterm></indexterm>
</keywords>
</metadata></prolog>
<taskbody>
<context><p>XML Catalog entries can be used in various situations. For example,
you are working on an XML file on your main desktop computer and point its <codeph>schemaLocation</codeph> towards
a schema called <codeph>c:\MySchema.xsd</codeph>. You then save it to your
laptop computer so you can work on it later. When you open the file on your
laptop, however, you encounter a problem - the XML editor cannot find the <codeph>MySchema.xsd</codeph> schema
because it is actually installed on your D drive. You will have to edit the <codeph>schemaLocation</codeph> to
point to <codeph>d:\MySchema.xsd</codeph>. When you have finished editing
the XML file and are ready to publish it on the Web, you will need to edit
the URI again so that it points to a resource that is accessible on the Web.
By now, the problem is obvious. A URI used within an XML file is not as portable
as you would like it to be. To avoid making frequent changes to your XML document,
you can use the XML Catalog.</p><p>An XML Catalog entry is used by an XML
processor when resolving entity references. You can provide rules to the catalog
to specify how entities should be resolved. If you consider the preceding
example, you could specify a rule that redirects an Internet resource reference
(for example, <codeph>"http://www.ibm.com/published-schemas/MySchema.xsd"</codeph>)
so that it points to a resource on the developer's local machine (for example,
<codeph>"file:///C:/MySchema.xsd"</codeph>). Now, instead of frequently editing
XML documents to update the URIs (especially when there are many documents
in your project), you only need to update a single rule in your XML Catalog.</p><p>The
following instructions were written for the Resource perspective, but they
will also work in many other perspectives.</p><p>To add an entry to the XML
Catalog, follow these steps:</p></context>
<steps>
<step><cmd>Open the XML file that you want to associate with a DTD or XML
schema.</cmd></step>
<step><cmd>Click <menucascade><uicontrol>Window</uicontrol><uicontrol>Preferences</uicontrol>
<uicontrol>Web and XML</uicontrol><uicontrol>XML Catalog</uicontrol></menucascade>.</cmd>
</step>
<step><cmd>The <uicontrol>XML Catalog Entries</uicontrol> field contains
a list of any user-defined and plug-in defined catalog entries.</cmd>
<substeps>
<substep><cmd>Select any entry to see details about it in the <uicontrol>Details</uicontrol> field. </cmd>
</substep>
<substep><cmd>Click <uicontrol>Add</uicontrol> to create a new catalog entry.</cmd>
</substep>
</substeps>
</step>
<step><cmd>In the <uicontrol>URI</uicontrol> field, type the location of the
DTD or XML schema or browse for it.</cmd></step>
<step><cmd>If you specified a DTD in the <uicontrol>URI</uicontrol> field,
you can select either <uicontrol>Public ID</uicontrol> or <uicontrol>System
ID</uicontrol> from the <uicontrol>Key Type</uicontrol> field.</cmd><info>If
you select <uicontrol>Public ID,</uicontrol> the value you enter in the <uicontrol>Key</uicontrol> field
should be the same as the Public ID in the XML file's DOCTYPE declaration.
If you select <uicontrol>System ID</uicontrol>, the value you enter should
correspond to the System ID in an XML file's DOCTYPE declaration.</info></step>
<step><cmd>If you specified an XML schema in the <uicontrol>URI</uicontrol> field,
you can select either <uicontrol>Namespace Name</uicontrol> or <uicontrol>Schema
Location</uicontrol> from the <uicontrol>Key Type</uicontrol> field.</cmd>
<info>If the schema defines a target namespace, it will automatically appear
in the <uicontrol>Key</uicontrol> field. Otherwise, you can enter the schema
location in the <uicontrol>Key</uicontrol> field.</info></step>
<step><cmd>Select the <uicontrol>Specify alternative Web address</uicontrol> check
box if you want to be able to specify an alternate Web address for the resource.</cmd>
<info>This Web address is used when an XML instance is generated from this
catalog entry. <b>Note</b>: This option is only available if you select <uicontrol>Public
ID</uicontrol> (for a DTD) or <uicontrol>Namespace Name</uicontrol> (for
a schema) in the <uicontrol>Key type</uicontrol> field.</info></step>
<step><cmd>If you want to refer to another catalog without importing it into
the workbench, click <uicontrol>Next Catalog</uicontrol>. Type or browse for
the XML catalog you want to refer to. </cmd></step>
<step><cmd>When you are done creating catalog entries, click <uicontrol>OK</uicontrol> to
close the Add XML Catalog Entry dialog. </cmd></step>
<step><cmd>Click <uicontrol>Advanced</uicontrol> if you want to import or
export any XML Catalog settings.</cmd></step>
<step><cmd>Click <uicontrol>Export</uicontrol> if you want to persist the
XML Catalog information. Only your user specified entries will be exported.</cmd>
<substeps>
<substep><cmd>You will be prompted to select a project and provide a file
name to store your catalog entries in an .xmlcatalog file, which can be opened
from the Navigator view. Snce your catalog entries are stored in an .xmlcatalog
file, you can check them in and out and share them like any other project
resource. </cmd></substep>
<substep><cmd>Click <uicontrol>OK</uicontrol>.</cmd></substep>
</substeps>
</step>
<step><cmd>Click <uicontrol>Import</uicontrol> if you want to import an .xmlcatalog
file. You will be prompted to select the file you want to import.</cmd>
<substeps>
<substep><cmd>When you import a .xmlcatalog file, any entries in it will be
loaded into the XML Catalog (and any existing entries will be overwritten). </cmd>
</substep>
<substep><cmd>Click <uicontrol>OK</uicontrol>.</cmd></substep>
</substeps>
</step>
<step><cmd>Click <uicontrol>OK</uicontrol> to close the Advanced XML Catalog
Preferences dialog.</cmd></step>
<step><cmd>Make sure the XML file is in focus and click the <uicontrol>Reload
dependencies</uicontrol> toolbar button. </cmd></step>
</steps>
<result>The XML file is now associated with the latest version of the XML
schema or DTD.</result>
</taskbody>
</task>
<?Pub *0000007087?>