blob: d6bb8471ef26c3b7e6f972491682ed18d76f8918 [file] [log] [blame]
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../..//default_style.css" type="text/css">
<link rel="stylesheet" href="../../../..//webtools/wtp.css" type="text/css">
<title>XML Catalog Tutorial</title>
</head>
<body>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<tbody>
<tr>
<td width="60%" align="left"><font class="indextop">XML Catalog Tutorial</font>
<br>
<font class="indexsub">XML Catalog Tutorial</font></td><td width="40%"><img width="207" hspace="50" height="129" align="middle" src="../../../..//webtools/images/wtplogosmall.jpg"></td>
</tr>
</tbody>
</table>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<col width="16">
<col width="*">
<tbody>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<p>
<b>By Richard Mah</b>
<BR>
Created on December 17, 2004<BR>
Updated on August 10, 2005<BR>
<BR>
In this tutorial, we will demonstrate the use of the XML Catalog. Add the Example &ldquo;Editing and validating XML files&rdquo;.
Select File -&gt; New -&gt; Other -&gt; Examples -&gt; Editing and Validating XML files.
To demonstrate the XML Catalog, let&rsquo;s use Invoice.dtd and Invoice.xml located in the XMLExamples project.
<ol>
<li>
Create a new folder &ldquo;Invoice2&rdquo; in the project &ldquo;XMLExamples&rdquo;.
</li>
<li>
Move Invoice.dtd located in XMLExamples\Invoice\ to the new location XMLExamples\Invoice2.
</li>
<li>
Validate Invoice.xml. See the validating XML tutorial. Notice the validation has generated a warning. This is because Invoice.dtd cannot be found. To fix this problem, we shall add an entry into the XML Catalog (demonstrated below).
</li>
</ol>
</p>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<p>
<div align="right">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody>
<tr>
<td colspan="2" align="left" bgcolor="#0080c0" valign="top"><b><font face="Arial,Helvetica"><font color="#ffffff">Adding and Removing from the XML Catalog</font></font></b></td>
</tr>
</tbody>
</table>
</div>
<BR>
The XML Catalog can be accessed through the preferences.
<ol>
<li>
Select &ldquo;Window -&gt; Preferences&rdquo; to launch the Preferences dialog.
</li>
<li>
Expand the &ldquo;Web and XML&rdquo; heading and select &ldquo;XML Catalog&rdquo;.
</li>
</ol>
The dialog should appear as in Figure 1.
<p>
<b>Figure 1</b>
<br>
<IMG border="0" src="images/XMLCatalog-Figure1.jpg"></p>
<H4>Adding an XML Catalog Entry</H4>
<ol>
<li>
From the Preferences XML Catalog dialog, select &ldquo;Add&hellip;&rdquo;.</li>
<li>
In the &ldquo;New XML Catalog Entry&rdquo; dialog, fill in the values as they
appear Figure 2.
<p>
<b>Figure 2</b>
<br>
<IMG border="0" src="images/XMLCatalog-Figure2.jpg"></p>
</li>
<li>
Click &ldquo;OK&rdquo; to finish. Notice there is a new entry, InvoiceId, under
&ldquo;User Specified Entries&rdquo;.</li>
<li>
Validate Invoice.xml again. Notice it is now valid.</li>
</ol>
<h4>Removing and Editing an XML Catalog Entry</h4>
To remove or edit an entry, simply select the entry and click on &ldquo;Delete&rdquo;
or &ldquo;Edit&hellip;&rdquo;.
<BR>
<BR>
<div align="right">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tbody>
<tr>
<td colspan="2" align="left" bgcolor="#0080c0" valign="top"><b><font face="Arial,Helvetica"><font color="#ffffff">Importing and Exporting a Catalog</font></font></b></td>
</tr>
</tbody>
</table>
</div>
<BR>
XML Catalog entries can be saved to a file for later use. This avoids
users having to add entries to an XML Catalog when they have already done
so in a previous workspace.
From the &ldquo;Advanced XML Catalog Preferences&rdquo; dialog, the importing and
exporting XML Catalog options are available. See Figure 3.
<p>
<b>Figure 3</b>
<br>
<IMG border="0" src="images/XMLCatalog-Figure3.jpg"></p>
<h4>Exporting XML Catalog settings:</h4>
<ol>
<li>
Selecting the &ldquo;Export&hellip;&rdquo; button on the &ldquo;Advanced XML Catalog Preferences&rdquo;
dialog.</li>
<li>
The &ldquo;Export XML Catalog Settings&rdquo; dialog will appear. See Figure
4. Select the Project &ldquo;Catalog&rdquo; (create if ncecessary) as the location to store the XML
Catalog settings file. Enter &ldquo;.xmlcatalog&rdquo; as the file name.
Click &ldquo;OK&rdquo; to finish. The entries specified in the XML Catalog will
now be saved in the file.</li>
</ol>
<p>
<b>Figure 4</b>
<br>
<IMG border="0" src="images/XMLCatalog-Figure4.jpg"></p>
<H4>Importing XML Catalog settings:</H4>
<ol>
<li>
Selecting the &ldquo;Import&hellip;&rdquo; button on the &ldquo;Advanced XML Catalog Preferences&rdquo; dialog.
</li>
<li>
The &ldquo;Import XML Catalog Settings&rdquo; dialog will appear. See Figure 5. Select the file containing the XML Catalog settings (.xmlcatalog) and click &ldquo;OK&rdquo; to finish. The entries specified in the file will now be in the XML Catalog.
</li>
</ol>
<p>
<b>Figure 5</b>
<br>
<IMG border="0" src="images/XMLCatalog-Figure5.jpg"></p>
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>