|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.resolver.readers.SAXCatalogReader
public class 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
Constructor Summary | |
---|---|
SAXCatalogReader()
The constructor |
|
SAXCatalogReader(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. |
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(Locator locator)
The SAX setDocumentLocator method. |
void |
setParserClass(java.lang.String parserClass)
Set the XML SAX Parser Class |
void |
setParserFactory(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,
AttributeList atts)
The SAX startElement method. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SAXCatalogReader()
public SAXCatalogReader(SAXParserFactory parserFactory)
public SAXCatalogReader(java.lang.String parserClass)
Method Detail |
---|
public void setParserFactory(SAXParserFactory parserFactory)
public void setParserClass(java.lang.String parserClass)
public 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 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
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(Locator locator)
setDocumentLocator
method. Does nothing.
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in interface DocumentHandler
locator
- an object that can return the location of
any SAX document eventLocator
public void startDocument() throws SAXException
startDocument
method. Does nothing.
startDocument
in interface ContentHandler
startDocument
in interface DocumentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public void endDocument() throws SAXException
endDocument
method. Does nothing.
endDocument
in interface ContentHandler
endDocument
in interface DocumentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void startElement(java.lang.String name, AttributeList atts) throws SAXException
startElement
method.
The catalog parser is selected based on the namespace of the first element encountered in the catalog.
startElement
in interface DocumentHandler
name
- The element type name.atts
- The attributes attached to the element, if any.
SAXException
- Any SAX exception, possibly
wrapping another exception.DocumentHandler.endElement(java.lang.String)
,
AttributeList
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws SAXException
startElement
method.
The catalog parser is selected based on the namespace of the first element encountered in the catalog.
startElement
in interface ContentHandler
namespaceURI
- the Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performedlocalName
- the local name (without prefix), or the
empty string if Namespace processing is not being
performedqName
- the qualified name (with prefix), or the
empty string if qualified names are not availableatts
- the attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object. The value of this object after
startElement returns is undefined
SAXException
- any SAX exception, possibly
wrapping another exceptionContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
Attributes
,
AttributesImpl
public void endElement(java.lang.String name) throws SAXException
endElement
method. Does nothing.
endElement
in interface DocumentHandler
name
- The element type name
SAXException
- Any SAX exception, possibly
wrapping another exception.public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws SAXException
endElement
method. Does nothing.
endElement
in interface ContentHandler
namespaceURI
- the Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performedlocalName
- the local name (without prefix), or the
empty string if Namespace processing is not being
performedqName
- the qualified XML name (with prefix), or the
empty string if qualified names are not available
SAXException
- any SAX exception, possibly
wrapping another exceptionpublic void characters(char[] ch, int start, int length) throws SAXException
characters
method. Does nothing.
characters
in interface ContentHandler
characters
in interface DocumentHandler
ch
- the characters from the XML documentstart
- the start position in the arraylength
- the number of characters to read from the array
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)
,
Locator
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
method. Does nothing.
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in interface DocumentHandler
ch
- the characters from the XML documentstart
- the start position in the arraylength
- the number of characters to read from the array
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException
processingInstruction
method. Does nothing.
processingInstruction
in interface ContentHandler
processingInstruction
in interface DocumentHandler
target
- the processing instruction targetdata
- the processing instruction data, or null if
none was supplied. The data does not include any
whitespace separating it from the target
SAXException
- Any SAX exception, possibly
wrapping another exception.public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws SAXException
startPrefixMapping
method. Does nothing.
startPrefixMapping
in interface ContentHandler
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
SAXException
- the client may throw
an exception during processingContentHandler.endPrefixMapping(java.lang.String)
,
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endPrefixMapping(java.lang.String prefix) throws SAXException
endPrefixMapping
method. Does nothing.
endPrefixMapping
in interface ContentHandler
prefix
- the prefix that was being mapped.
This is the empty string when a default mapping scope ends.
SAXException
- the client may throw
an exception during processingContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
,
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void skippedEntity(java.lang.String name) throws SAXException
skippedentity
method. Does nothing.
skippedEntity
in interface ContentHandler
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]"
SAXException
- any SAX exception, possibly
wrapping another exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |