![]()
|
XMLCatalogAn XMLCatalog is a catalog of public resources such as DTDs or entities that are referenced in an XML document. Catalogs are typically used to make web references to resources point to a locally cached copy of the resource. This allows the XML Parser, XSLT Processor or other consumer of XML documents to efficiently allow a local substitution for a resource available on the web. This data type provides a catalog of resource locations based on the OASIS "Open Catalog" standard. The catalog entries are used both for Entity resolution and URI resolution, in accordance with Processing (JAXP) Specification. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">The XML processor, without XMLCatalog support, would need to retrieve the DTD from the URL specified whenever validation of the document was required. This can be very time consuming during the build process, especially where network throughput is limited. Alternatively, you can do the following:
location attribute points to the file.
XMLCatalogs can appear inside tasks
that support this feature or at the same level as XMLCatalogs are specified as either a reference to another XMLCatalog,
defined
previously in a build file, or as a list of XMLCatalogs can also be nested inside other XMLCatalogs. For example, a "superset" XMLCatalog could be made by including several nested XMLCatalogs that referred to other, previously defined Currently, only Entity/DTD/URI Resolution AlgorithmWhen an entity, DTD, or URI is looked up by the XML processor, the it attempts to match thepublicId attribute of each entry
with the PublicID or URI of the entity to be resolved. Assuming a
matching entry is found, XMLCatalog then executes the following steps:
1. Filesystem lookupThe 2. Classpath lookupThe 3. URL-space lookupFinally, we attempt to make a URL out of the XMLCatalog attributes
XMLCatalog nested elementsdtd/entityThe
classpathThe classpath to use for entity
resolution. The nested ExamplesSet up an XMLCatalog with a single dtd referenced locally in a user's home directory: <dtd publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" location="/home/dion/downloads/docbook/docbookx.dtd"/> Set up an XMLCatalog with a multiple dtds to be found either in the filesystem (relative to the Ant project basedir) or in the classpath: <dtd publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" location="docbook/docbookx.dtd"/> <dtd publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" location="web-app_2_2.dtd"/> Set up an XMLCatalog with a combination of DTDs and entities as well as a nested XMLCatalog: <dtd publicId="-//ArielPartners//DTD XML Article V1.0//EN" location="com/arielpartners/knowledgebase/dtd/article.dtd"/> <entity publicId="LargeLogo" location="com/arielpartners/images/ariel-logo-large.gif"/> To reference the above XMLCatalog in an
<xslt basedir="${source.doc}" destdir="${dest.xdocs}" style="${source.xsl.converter.docbook}" force="true"> </xslt> Copyright © 2002 Apache Software Foundation. All rights Reserved. |