FSCatalog loads an XML catalog file to read mappings of public IDs for XML schemas/dtds, to resolve those mappings to a local store for the schemas. The catalog file allows one to have a single mapping of schema IDs to local files, and is useful when there are many schemas, or when schemas are broken into many smaller files. Currently FSCatalog only supports the very simple mapping of public id to local URI using the public element in the catalog XML.
FSCatalog is not an EntityResolver; it only parses a catalog file. See
FSEntityResolver for entity resolution.
To use, instantiate the class, and call parseCatalog(InputSource)
to retrieve a java. keyed by public ids. The class uses
an XMLReader instance retrieved via XMLResource#newXMLReader(), so
XMLReader configuration (and specification) follows that of the standard XML
parsing in Flying Saucer.
This class is not safe for multi-threaded access.
| Modifier and Type | Class and Description |
|---|---|
| private static class | FSCatalog.
A SAX ContentHandler that reads an XML catalog file and builds a Map of public IDs to local URIs. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | addHandlers(XMLReader xmlReader, ContentHandler ch)
Adds the default EntityResolved and ErrorHandler for the SAX parser. |
| public Map | parseCatalog(String
A String URI to a catalog XML file on the classpath. catalogURI)Parses an XML catalog file and returns a Map of public ids to local URIs read from the catalog. |
| public Map | parseCatalog(InputSource
A SAX InputSource to a catalog XML file on the classpath. inputSource)Parses an XML catalog file and returns a Map of public ids to local URIs read from the catalog. |
| private void | setFeature(XMLReader xmlReader, String featureUri, boolean value)
Attempts to set requested feature on the parser; logs exception if not supported or not recognized. |
| FSCatalog | back to summary |
|---|---|
| public FSCatalog() | |
| addHandlers | back to summary |
|---|---|
| private void addHandlers(XMLReader xmlReader, ContentHandler ch) Adds the default EntityResolved and ErrorHandler for the SAX parser. | |
| parseCatalog | back to summary |
|---|---|
| public Map Parses an XML catalog file and returns a Map of public ids to local URIs read from the catalog. Only the catalog public elements are parsed.
| |
| parseCatalog | back to summary |
|---|---|
| public Map Parses an XML catalog file and returns a Map of public ids to local URIs read from the catalog. Only the catalog public elements are parsed.
| |
| setFeature | back to summary |
|---|---|
| private void setFeature(XMLReader xmlReader, String featureUri, boolean value) Attempts to set requested feature on the parser; logs exception if not supported or not recognized. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Map | |
| public void | startElement(String
The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed. namespaceURI, String The local name (without prefix), or the
empty string if Namespace processing is not being
performed. localName, String The qualified name (with prefix), or the
empty string if qualified names are not available. qName, Attributes The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object. atts)Overrides org. Implements org. Receive notification of the beginning of an element; here used to pick up the mappings for public IDs to local URIs in the catalog. |
| entityMap | back to summary |
|---|---|
| private final Map<String, String> entityMap | |
| CatalogContentHandler | back to summary |
|---|---|
| public CatalogContentHandler() | |
| getEntityMap | back to summary |
|---|---|
| public Map Returns a Map of public Ids to local URIs | |
| startElement | back to summary |
|---|---|
| public void startElement(String namespaceURI, String localName, String qName, Attributes atts) Overrides org. Implements org. Receive notification of the beginning of an element; here used to pick up the mappings for public IDs to local URIs in the catalog.
| |