| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <title>XMLCatalog Type</title> |
| </head> |
| |
| <body> |
| |
| <h2><a name="XMLCatalog">XMLCatalog</a></h2> |
| <p>An XMLCatalog is a catalog of public resources such as DTDs or entities |
| that |
| are referenced in an XML document and are available locally.</p> |
| <p>This allows the XML Parser, XSL Processor or other consumer of XML |
| documents |
| to efficiently allow a local substitution for a resource available on the |
| web. |
| </p> |
| <p>For example, in a <code>web.xml</code> file, the DTD is referenced as: |
| <pre> |
| <!DOCTYPE web-app |
| PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application |
| 2.2//EN" |
| "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> |
| </pre> |
| The XML processor, without XMLCatalog support, would need to retrieve the |
| DTD from |
| the URL specified whenever validation of the document was required. |
| </p> |
| <p>This can be very time consuming during the build process, especially |
| where |
| network throughput is limited.</p> |
| </p> |
| <p>XMLCatalogs can appear inside tasks |
| that support this feature or at the same level as <code>target</code> |
| - i.e., as children of <code>project</code> for reuse across different |
| tasks, |
| e.g. XML Validation and XSL Translation.</p> |
| <p>XMLCatalogs are specified as either a reference to another XMLCatalog, |
| defined |
| previously in a build file, or as a list of <code>dtd</code> or |
| <code>entity</code> locations.</p> |
| <h3>XMLCatalog attributes</h3> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">id</td> |
| <td valign="top">a unique name for an XMLCatalog, used for referencing |
| the |
| XMLCatalog's contents from another XMLCatalog</td> |
| <td valign="top" align="center">No</td> |
| </tr> |
| <tr> |
| <td valign="top">refid</td> |
| <td valign="top">the <code>id</code> of another XMLCatalog whose |
| contents |
| you would like to be used for this XMLCatalog</td> |
| <td valign="top" align="center">No</td> |
| </tr> |
| </table> |
| |
| <h3>XMLCatalog nested elements</h3> |
| <p>The <code>dtd</code> and <code>entity</code> elements used to specify |
| XMLCatalogs are identical in their structure</p> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">publicId</td> |
| <td valign="top">The public identifier used when defining a dtd or |
| entity, |
| e.g. <code>"-//Sun Microsystems, Inc.//DTD Web Application |
| 2.2//EN"</code> |
| </td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top">location</td> |
| <td valign="top">The location of the local replacement to be used for |
| the |
| public identifier specified. This may be specified as a file name, |
| resource |
| name found on the classpath, or a URL |
| </td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| </table> |
| <h3>Examples</h4> |
| <p>Set up an XMLCatalog with a single dtd referenced locally in a user's |
| home |
| directory:</p> |
| <blockquote><pre> |
| <xmlcatalog> |
| <dtd publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" |
| location="/home/dion/downloads/docbook/docbookx.dtd"/> |
| </xmlcatalog> |
| </pre></blockquote> |
| <p>Set up an XMLCatalog with a multiple dtds referenced locally in a |
| user's home |
| directory:</p> |
| <blockquote><pre> |
| <xmlcatalog id="commonDTDs"> |
| <dtd publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" |
| location="/home/dion/downloads/docbook/docbookx.dtd"/> |
| <dtd publicId="-//Sun Microsystems, Inc.//DTD Web |
| Application 2.2//EN" |
| location="/home/dion/web-app_2_2.dtd"/> |
| </xmlcatalog> |
| </pre></blockquote> |
| <p>To reference the above xmlcatalog in a style task:<p> |
| <blockquote><pre> |
| <style basedir="${source.doc}" |
| destdir="${dest.xdocs}" |
| extension=".xml" |
| style="${source.xsl.converter.docbook}" |
| includes="**/*.xml" |
| force="true"> |
| <xmlcatalog refid="commonDTDs"/> |
| </style> |
| </pre></blockquote> |
| |
| <hr> |
| <p align="center">Copyright © 2002 Apache Software Foundation. All |
| rights |
| Reserved.</p> |
| |
| </body> |
| </html> |