Save This Page
Home » openjdk-7 » com.sun.org.apache.xml.internal » resolver » readers » [javadoc | source]
com.sun.org.apache.xml.internal.resolver.readers
public class: SAXCatalogReader [javadoc | source]
java.lang.Object
   com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader

All Implemented Interfaces:
    ContentHandler, CatalogReader, DocumentHandler

Direct Known Subclasses:
    ExtendedXMLCatalogReader, XCatalogReader, OASISXMLCatalogReader

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.

Field Summary
protected  SAXParserFactory parserFactory    The SAX Parser Factory 
protected  String parserClass    The SAX Parser Class 
protected  Hashtable namespaceMap    Mapping table from QNames to CatalogParser classes.

Each key in this hash table has the form "elementname" or "{namespaceuri}elementname". The former is used if the namespace URI is null.

 
protected  Debug debug    The debug class to use for this reader. This is a bit of a hack. Anyway, whenever we read for a catalog, we extract the debug object from the catalog's manager so that we can use it to print messages. In production, we don't really expect any messages so it doesn't really matter. But it's still a bit of a hack. 
Constructor:
 public SAXCatalogReader() 
 public SAXCatalogReader(SAXParserFactory parserFactory) 
    The constructor
 public SAXCatalogReader(String parserClass) 
    The constructor
Method from com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader Summary:
characters,   endDocument,   endElement,   endElement,   endPrefixMapping,   getCatalogParser,   getParserClass,   getParserFactory,   ignorableWhitespace,   processingInstruction,   readCatalog,   readCatalog,   setCatalogParser,   setDocumentLocator,   setParserClass,   setParserFactory,   skippedEntity,   startDocument,   startElement,   startElement,   startPrefixMapping
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader Detail:
 public  void characters(char[] ch,
    int start,
    int length) throws SAXException 
    The SAX characters method. Does nothing.
 public  void endDocument() throws SAXException 
    The SAX endDocument method. Does nothing.
 public  void endElement(String name) throws SAXException 
    The SAX endElement method. Does nothing.
 public  void endElement(String namespaceURI,
    String localName,
    String qName) throws SAXException 
    The SAX2 endElement method. Does nothing.
 public  void endPrefixMapping(String prefix) throws SAXException 
    The SAX endPrefixMapping method. Does nothing.
 public String getCatalogParser(String namespaceURI,
    String rootElement) 
    Get the SAXCatalogParser class for the given namespace/root element type.
 public String getParserClass() 
    Get the parser class currently in use.
 public SAXParserFactory getParserFactory() 
    Get the parser factory currently in use.
 public  void ignorableWhitespace(char[] ch,
    int start,
    int length) throws SAXException 
    The SAX ignorableWhitespace method. Does nothing.
 public  void processingInstruction(String target,
    String data) throws SAXException 
    The SAX processingInstruction method. Does nothing.
 public  void readCatalog(Catalog catalog,
    String fileUrl) throws MalformedURLException, IOException, CatalogException 
    Parse an XML Catalog file.
 public  void readCatalog(Catalog catalog,
    InputStream is) throws IOException, CatalogException 
    Parse an XML Catalog stream.
 public  void setCatalogParser(String namespaceURI,
    String rootElement,
    String parserClass) 
    Set the SAXCatalogParser class for the given namespace/root element type.
 public  void setDocumentLocator(Locator locator) 
    The SAX setDocumentLocator method. Does nothing.
 public  void setParserClass(String parserClass) 
    Set the XML SAX Parser Class
 public  void setParserFactory(SAXParserFactory parserFactory) 
    Set the XML SAX Parser Factory.
 public  void skippedEntity(String name) throws SAXException 
    The SAX skippedentity method. Does nothing.
 public  void startDocument() throws SAXException 
    The SAX startDocument method. Does nothing.
 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.

 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.

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