|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xml.resolver.readers.SAXCatalogReader
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.
Catalog
,
CatalogReader
,
SAXCatalogReader
,
TextCatalogReader
,
DOMCatalogParser
Field Summary | |
---|---|
protected Debug |
debug
The debug class to use for this reader. |
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 |
setClassLoader(java.lang.ClassLoader loader)
Set the class loader to use when loading class by reflection. |
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
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
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 setClassLoader(java.lang.ClassLoader loader)
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
readCatalog
in interface CatalogReader
catalog
- The catalog to which this catalog file belongsfileUrl
- The URL or filename of the catalog file to processjava.net.MalformedURLException
- Improper fileUrljava.io.IOException
- Error reading catalog filepublic void readCatalog(Catalog catalog, java.io.InputStream is) throws java.io.IOException, CatalogException
readCatalog
in interface CatalogReader
catalog
- The catalog to which this catalog file belongsis
- The input stream from which the catalog will be readjava.net.MalformedURLException
- Improper fileUrljava.io.IOException
- Error reading catalog fileCatalogException
- A Catalog exceptionpublic void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
method. Does nothing.setDocumentLocator
in interface org.xml.sax.ContentHandler
public void startDocument() throws org.xml.sax.SAXException
startDocument
method. Does nothing.startDocument
in interface org.xml.sax.ContentHandler
public void endDocument() throws org.xml.sax.SAXException
endDocument
method. Does nothing.endDocument
in interface org.xml.sax.ContentHandler
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException
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
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
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
public void endElement(java.lang.String name) throws org.xml.sax.SAXException
endElement
method. Does nothing.endElement
in interface org.xml.sax.DocumentHandler
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
method. Does nothing.endElement
in interface org.xml.sax.ContentHandler
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
method. Does nothing.characters
in interface org.xml.sax.ContentHandler
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
method. Does nothing.ignorableWhitespace
in interface org.xml.sax.ContentHandler
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
method. Does nothing.processingInstruction
in interface org.xml.sax.ContentHandler
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
method. Does nothing.startPrefixMapping
in interface org.xml.sax.ContentHandler
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
method. Does nothing.endPrefixMapping
in interface org.xml.sax.ContentHandler
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedentity
method. Does nothing.skippedEntity
in interface org.xml.sax.ContentHandler
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |