org.apache.xml.resolver.readers
Class XCatalogReader

java.lang.Object
  extended by org.apache.xml.resolver.readers.SAXCatalogReader
      extended by org.apache.xml.resolver.readers.XCatalogReader
All Implemented Interfaces:
CatalogReader, SAXCatalogParser, ContentHandler, DocumentHandler

public class XCatalogReader
extends SAXCatalogReader
implements SAXCatalogParser

Parse "XCatalog" XML Catalog files, this is the XML Catalog format developed by John Cowan and supported by Apache.

Version:
1.0
Author:
Norman Walsh Norman.Walsh@Sun.COM
See Also:
Catalog

Constructor Summary
XCatalogReader()
          Default constructor
XCatalogReader(SAXParserFactory parserFactory, Catalog catalog)
          Constructor allowing for providing custom SAX parser factory
 
Method Summary
 void characters(char[] ch, int start, int length)
          The SAX characters method does nothing.
 void endDocument()
          The SAX endDocument method does nothing.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          The SAX endElement method does nothing.
 void endPrefixMapping(java.lang.String prefix)
          The SAX endPrefixMapping method does nothing.
 Catalog getCatalog()
          Get the current catalog.
 void ignorableWhitespace(char[] ch, int start, int length)
          The SAX ignorableWhitespace method does nothing.
 void processingInstruction(java.lang.String target, java.lang.String data)
          The SAX processingInstruction method does nothing.
 void setCatalog(Catalog catalog)
          Set the current catalog.
 void setDocumentLocator(Locator locator)
          The SAX setDocumentLocator method does nothing.
 void skippedEntity(java.lang.String name)
          The SAX skippedEntity method does nothing.
 void startDocument()
          The SAX startDocument method does nothing.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts)
          The SAX startElement method recognizes elements from the plain catalog format and instantiates CatalogEntry objects for them.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          The SAX startPrefixMapping method does nothing.
 
Methods inherited from class org.apache.xml.resolver.readers.SAXCatalogReader
endElement, getCatalogParser, getParserClass, getParserFactory, readCatalog, readCatalog, setCatalogParser, setClassLoader, setParserClass, setParserFactory, startElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.DocumentHandler
endElement, startElement
 

Constructor Detail

XCatalogReader

public XCatalogReader()
Default constructor


XCatalogReader

public XCatalogReader(SAXParserFactory parserFactory,
                      Catalog catalog)
Constructor allowing for providing custom SAX parser factory

Method Detail

setCatalog

public void setCatalog(Catalog catalog)
Set the current catalog.

Specified by:
setCatalog in interface SAXCatalogParser

getCatalog

public Catalog getCatalog()
Get the current catalog.


setDocumentLocator

public void setDocumentLocator(Locator locator)
The SAX setDocumentLocator method does nothing.

Specified by:
setDocumentLocator in interface ContentHandler
Specified by:
setDocumentLocator in interface DocumentHandler
Overrides:
setDocumentLocator in class SAXCatalogReader
Parameters:
locator - an object that can return the location of any SAX document event
See Also:
Locator

startDocument

public void startDocument()
                   throws SAXException
The SAX startDocument method does nothing.

Specified by:
startDocument in interface ContentHandler
Specified by:
startDocument in interface DocumentHandler
Overrides:
startDocument in class SAXCatalogReader
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endDocument()

endDocument

public void endDocument()
                 throws SAXException
The SAX endDocument method does nothing.

Specified by:
endDocument in interface ContentHandler
Specified by:
endDocument in interface DocumentHandler
Overrides:
endDocument in class SAXCatalogReader
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startDocument()

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         Attributes atts)
                  throws SAXException
The SAX startElement method recognizes elements from the plain catalog format and instantiates CatalogEntry objects for them.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class SAXCatalogReader
Parameters:
namespaceURI - The namespace name of the element.
localName - The local name of the element.
qName - The QName of the element.
atts - The list of attributes on the element.
Throws:
SAXException - any SAX exception, possibly wrapping another exception
See Also:
CatalogEntry

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws SAXException
The SAX endElement method does nothing.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class SAXCatalogReader
Parameters:
namespaceURI - the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
localName - the local name (without prefix), or the empty string if Namespace processing is not being performed
qName - the qualified XML name (with prefix), or the empty string if qualified names are not available
Throws:
SAXException - any SAX exception, possibly wrapping another exception

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
The SAX characters method does nothing.

Specified by:
characters in interface ContentHandler
Specified by:
characters in interface DocumentHandler
Overrides:
characters in class SAXCatalogReader
Parameters:
ch - the characters from the XML document
start - the start position in the array
length - the number of characters to read from the array
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.ignorableWhitespace(char[], int, int), Locator

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
The SAX ignorableWhitespace method does nothing.

Specified by:
ignorableWhitespace in interface ContentHandler
Specified by:
ignorableWhitespace in interface DocumentHandler
Overrides:
ignorableWhitespace in class SAXCatalogReader
Parameters:
ch - the characters from the XML document
start - the start position in the array
length - the number of characters to read from the array
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.characters(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws SAXException
The SAX processingInstruction method does nothing.

Specified by:
processingInstruction in interface ContentHandler
Specified by:
processingInstruction in interface DocumentHandler
Overrides:
processingInstruction in class SAXCatalogReader
Parameters:
target - the processing instruction target
data - the processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws SAXException
The SAX skippedEntity method does nothing.

Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in class SAXCatalogReader
Parameters:
name - the name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]"
Throws:
SAXException - any SAX exception, possibly wrapping another exception

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws SAXException
The SAX startPrefixMapping method does nothing.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class SAXCatalogReader
Parameters:
prefix - the Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.
uri - the Namespace URI the prefix is mapped to
Throws:
SAXException - the client may throw an exception during processing
See Also:
ContentHandler.endPrefixMapping(java.lang.String), ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws SAXException
The SAX endPrefixMapping method does nothing.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class SAXCatalogReader
Parameters:
prefix - the prefix that was being mapped. This is the empty string when a default mapping scope ends.
Throws:
SAXException - the client may throw an exception during processing
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String), ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)