|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.resolver.readers.SAXCatalogReader
A SAX-based CatalogReader
Copyright © 2000, 2001 Sun Microsystems, Inc. All Rights Reserved. This software is the proprietary information of Sun Microsystems, Inc. Use is subject to license terms.
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.
Catalog
,
CatalogReader
,
SAXCatalogReader
,
TextCatalogReader
,
DOMCatalogParser
Field Summary | |
protected java.util.Hashtable |
namespaceMap
Mapping table from QNames to CatalogParser classes. |
protected java.lang.String |
parserClass
The SAX Parser Class |
protected javax.xml.parsers.SAXParserFactory |
parserFactory
The SAX Parser Factory |
Constructor Summary | |
SAXCatalogReader()
The constructor |
|
SAXCatalogReader(javax.xml.parsers.SAXParserFactory parserFactory)
The constructor |
|
SAXCatalogReader(java.lang.String parserClass)
The constructor |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
The SAX characters method. |
void |
endDocument()
The SAX endDocument method. |
void |
endElement(java.lang.String name)
The SAX endElement method. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
The SAX2 endElement method. |
void |
endPrefixMapping(java.lang.String prefix)
The SAX endPrefixMapping method. |
java.lang.String |
getCatalogParser(java.lang.String namespaceURI,
java.lang.String rootElement)
Get the SAXCatalogParser class for the given namespace/root element type. |
java.lang.String |
getParserClass()
Get the parser class currently in use. |
javax.xml.parsers.SAXParserFactory |
getParserFactory()
Get the parser factory currently in use. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
The SAX ignorableWhitespace method. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
The SAX processingInstruction method. |
void |
readCatalog(Catalog catalog,
java.io.InputStream is)
Parse an XML Catalog stream. |
void |
readCatalog(Catalog catalog,
java.lang.String fileUrl)
Parse an XML Catalog file. |
void |
setCatalogParser(java.lang.String namespaceURI,
java.lang.String rootElement,
java.lang.String parserClass)
Set the SAXCatalogParser class for the given namespace/root element type. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
The SAX setDocumentLocator method. |
void |
setParserClass(java.lang.String parserClass)
Set the XML SAX Parser Class |
void |
setParserFactory(javax.xml.parsers.SAXParserFactory parserFactory)
Set the XML SAX Parser Factory. |
void |
skippedEntity(java.lang.String name)
The SAX skippedentity method. |
void |
startDocument()
The SAX startDocument method. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
The SAX startElement method. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
The SAX2 startElement method. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
The SAX startPrefixMapping method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.xml.parsers.SAXParserFactory parserFactory
protected java.lang.String parserClass
protected java.util.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.
Constructor Detail |
public SAXCatalogReader()
public SAXCatalogReader(javax.xml.parsers.SAXParserFactory parserFactory)
public SAXCatalogReader(java.lang.String parserClass)
Method Detail |
public void setParserFactory(javax.xml.parsers.SAXParserFactory parserFactory)
public void setParserClass(java.lang.String parserClass)
public javax.xml.parsers.SAXParserFactory getParserFactory()
public java.lang.String getParserClass()
public void setCatalogParser(java.lang.String namespaceURI, java.lang.String rootElement, java.lang.String parserClass)
public java.lang.String getCatalogParser(java.lang.String namespaceURI, java.lang.String rootElement)
public void readCatalog(Catalog catalog, java.lang.String fileUrl) throws java.net.MalformedURLException, java.io.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
java.net.MalformedURLException
- Improper fileUrl
java.io.IOException
- Error reading catalog file
CatalogException
public void readCatalog(Catalog catalog, java.io.InputStream is) throws java.io.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
java.net.MalformedURLException
- Improper fileUrl
java.io.IOException
- Error reading catalog file
CatalogException
- A Catalog exceptionpublic void setDocumentLocator(org.xml.sax.Locator locator)
The SAX setDocumentLocator
method. Does nothing.
setDocumentLocator
in interface org.xml.sax.ContentHandler
public void startDocument() throws org.xml.sax.SAXException
The SAX startDocument
method. Does nothing.
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
The SAX endDocument
method. Does nothing.
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException
The SAX startElement
method.
The catalog parser is selected based on the namespace of the first element encountered in the catalog.
startElement
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
The SAX2 startElement
method.
The catalog parser is selected based on the namespace of the first element encountered in the catalog.
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String name) throws org.xml.sax.SAXException
The SAX endElement
method. Does nothing.
endElement
in interface org.xml.sax.DocumentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
The SAX2 endElement
method. Does nothing.
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
The SAX characters
method. Does nothing.
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
The SAX ignorableWhitespace
method. Does nothing.
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
The SAX processingInstruction
method. Does nothing.
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
The SAX startPrefixMapping
method. Does nothing.
startPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
The SAX endPrefixMapping
method. Does nothing.
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
The SAX skippedentity
method. Does nothing.
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |