Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.apache.xerces.readers
Class XCatalog

    java.lang.Object
      |
      +--weblogic.apache.xerces.readers.XMLCatalogHandler
            |
            +--weblogic.apache.xerces.readers.XCatalog

public class XCatalog
extends XMLCatalogHandler

This catalog supports the XCatalog proposal draft 0.2 posted to the xml-dev mailing list by John Cowan. XCatalog is an XML representation of the SGML Open TR9401:1997 catalog format. The current proposal supports public identifier maps, system identifier aliases, and public identifier prefix delegates. Refer to the XCatalog DTD for the full specification of this catalog format at http://www.ccil.org/~cowan/XML/XCatalog.html.

In order to use XCatalogs, you must write the catalog files with the following restrictions:

- You must follow the XCatalog grammar.
- You must specify the `<!DOCTYPE>` line with the `PUBLIC` specified as "-//DTD XCatalog//EN" or make sure that the system identifier is able to locate the XCatalog 0.2 DTD (which is included in the Jar file containing the weblogic.apache.xerces.readers.XCatalog class). For example:

         <!DOCTYPE XCatalog PUBLIC "-//DTD XCatalog//EN" "weblogic/apache/xerces/readers/xcatalog.dtd">

- The enclosing `<XCatalog>` document root element is not optional -- it must be specified.
- The `Version` attribute of the `<XCatalog>` has been modified from '`#FIXED "1.0"`' to '`(0.1|0.2) "0.2"`'.

To use this catalog in a parser, set an XCatalog instance as the parser's `EntityResolver`. For example:

       XMLParser parser  = new AnyParser();
       Catalog   catalog = new XCatalog();
       parser.getEntityHandler().setEntityResolver(catalog);

Once installed, catalog files that conform to the XCatalog grammar can be appended to the catalog by calling the `loadCatalog` method on the parser or the catalog instance. The following example loads the contents of two catalog files:

       parser.loadCatalog(new InputSource("catalogs/cat1.xml"));
       parser.loadCatalog(new InputSource("http://host/catalogs/cat2.xml"));

Limitations: The following are the current limitations of this XCatalog implementation:

- No error checking is done to avoid circular `Delegate` or `Extend` references. Do not specify a combination of catalog files that reference each other.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Version:
  $Id: XCatalog.java,v 1.2 2000/04/04 21:14:25 andyc Exp $
Author:
  Andy Clark, IBM

Field Summary
`static java.lang.String` | `XCATALOG_DTD_PUBLICID` XCatalog public identifier string ("-//DTD XCatalog//EN").

Constructor Summary
`XCatalog()` Constructs an XCatalog instance.

Method Summary
`void` | `addDelegateCatalog(java.lang.String prefix, XCatalog catalog)` Adds a delegate mapping.
`XCatalog` | `getDelegateCatalog(java.lang.String prefix)` Returns the catalog for the given delegate prefix.
`java.util.Enumeration` | `getDelegateCatalogKeys()` Returns an enumeration of delegate prefixes.
`void` | `loadCatalog(org.xml.sax.InputSource source)` Loads the catalog stream specified by the given input source and appends the contents to the catalog.
`void` | `removeDelegateCatalog(java.lang.String prefix)` Removes a delegate.
`org.xml.sax.InputSource` | `resolveEntity(java.lang.String publicId, java.lang.String systemId)` Resolves external entities.

Methods inherited from class weblogic.apache.xerces.readers.XMLCatalogHandler
`addPublicMapping, addSystemMapping, getPublicMapping, getPublicMappingKeys, getSystemMapping, getSystemMappingKeys, removePublicMapping, removeSystemMapping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### XCATALOG_DTD_PUBLICID

    public static final java.lang.String XCATALOG_DTD_PUBLICID

  XCatalog public identifier string ("-//DTD XCatalog//EN").

Constructor Detail

### XCatalog

    public XCatalog()

  Constructs an XCatalog instance.

Method Detail

### loadCatalog

    public void loadCatalog(org.xml.sax.InputSource source)
                     throws org.xml.sax.SAXException,
                            java.io.IOException

  Loads the catalog stream specified by the given input source and appends the contents to the catalog.

  Parameters:
    `source` - The catalog source.
  Throws:
    org.xml.sax.SAXException - Throws exception on SAX error.
    java.io.IOException - Throws exception on i/o error.
  Overrides:
    loadCatalog in class XMLCatalogHandler

### resolveEntity

    public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                                 java.lang.String systemId)
                                          throws org.xml.sax.SAXException,
                                                 java.io.IOException

  Resolves external entities.

  Parameters:
    `publicId` - The public identifier used for entity resolution.
    `systemId` - If the publicId is not null, this systemId is to be considered the default system identifier; else a system identifier alias mapping is requested.
  Returns:
    Returns the input source of the resolved entity or null if no resolution is possible.
  Throws:
    org.xml.sax.SAXException - Exception thrown on SAX error.
    java.io.IOException - Exception thrown on i/o error.
  Overrides:
    resolveEntity in class XMLCatalogHandler

### addDelegateCatalog

    public void addDelegateCatalog(java.lang.String prefix,
                                   XCatalog catalog)

  Adds a delegate mapping. If the prefix of a public identifier matches a delegate prefix, then the delegate catalog is searched in order to resolve the identifier.

  This method makes sure that prefixes that match each other are inserted into the delegate list in order of longest prefix length first.

  Parameters:
    `prefix` - The delegate prefix.
    `catalog` - The delegate catalog.

### removeDelegateCatalog

    public void removeDelegateCatalog(java.lang.String prefix)

  Removes a delegate.

  Parameters:
    `prefix` - The delegate prefix to remove.

### getDelegateCatalogKeys

    public java.util.Enumeration getDelegateCatalogKeys()

  Returns an enumeration of delegate prefixes.

### getDelegateCatalog

    public XCatalog getDelegateCatalog(java.lang.String prefix)

  Returns the catalog for the given delegate prefix.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs70
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference