A SAX-based CatalogReader.
This class is used to read XML Catalogs using the SAX. This reader
has an advantage over the DOM-based reader in that it functions on
the stream of SAX events. It has the disadvantage
that it cannot look around in the tree.
Since the choice of CatalogReaders (in the InputStream case) can only
be made on the basis of MIME type, the following problem occurs: only
one CatalogReader can exist for all XML mime types. In order to get
around this problem, the SAXCatalogReader relies on a set of external
CatalogParsers to actually build the catalog.
The selection of CatalogParsers is made on the basis of the QName
of the root element of the document.
characters
public void characters(ch[] ,
int start,
int length)
throws SAXException
The SAX characters
method. Does nothing.
endDocument
public void endDocument()
throws SAXException
The SAX endDocument
method. Does nothing.
endElement
public void endElement(String name)
throws SAXException
The SAX endElement
method. Does nothing.
endElement
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
The SAX2 endElement
method. Does nothing.
endPrefixMapping
public void endPrefixMapping(String prefix)
throws SAXException
The SAX endPrefixMapping
method. Does nothing.
getCatalogParser
public String getCatalogParser(String namespaceURI,
String rootElement)
Get the SAXCatalogParser class for the given namespace/root
element type.
getParserClass
public String getParserClass()
Get the parser class currently in use.
getParserFactory
public SAXParserFactory getParserFactory()
Get the parser factory currently in use.
ignorableWhitespace
public void ignorableWhitespace(ch[] ,
int start,
int length)
throws SAXException
The SAX ignorableWhitespace
method. Does nothing.
processingInstruction
public void processingInstruction(String target,
String data)
throws SAXException
The SAX processingInstruction
method. Does nothing.
readCatalog
public void readCatalog(Catalog catalog,
InputStream is)
throws IOException,
CatalogException
Parse an XML Catalog stream.
- readCatalog in interface CatalogReader
catalog
- The catalog to which this catalog file belongsis
- The input stream from which the catalog will be read
readCatalog
public void readCatalog(Catalog catalog,
String fileUrl)
throws MalformedURLException,
IOException,
CatalogException
Parse an XML Catalog file.
- readCatalog in interface CatalogReader
catalog
- The catalog to which this catalog file belongsfileUrl
- The URL or filename of the catalog file to process
setCatalogParser
public void setCatalogParser(String namespaceURI,
String rootElement,
String parserClass)
Set the SAXCatalogParser class for the given namespace/root
element type.
setDocumentLocator
public void setDocumentLocator(Locator locator)
The SAX setDocumentLocator
method. Does nothing.
setParserClass
public void setParserClass(String parserClass)
Set the XML SAX Parser Class
setParserFactory
public void setParserFactory(SAXParserFactory parserFactory)
Set the XML SAX Parser Factory.
skippedEntity
public void skippedEntity(String name)
throws SAXException
The SAX skippedentity
method. Does nothing.
startDocument
public void startDocument()
throws SAXException
The SAX startDocument
method. Does nothing.
startElement
public void startElement(String name,
AttributeList atts)
throws SAXException
The SAX
startElement
method.
The catalog parser is selected based on the namespace of the
first element encountered in the catalog.
startElement
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
The SAX2
startElement
method.
The catalog parser is selected based on the namespace of the
first element encountered in the catalog.
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
The SAX startPrefixMapping
method. Does nothing.