|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.portal.utils.SAX2FilterImpl
public class SAX2FilterImpl
This is a remake of org.xml.sax.helpers.XMLFilterImpl
that allows for downward chaining of LexicalHandlers, and further extensions.
Some of the behavior is slightly different from that of hte XMLFilterImpl. For example this implementation allows to set null handlers. It also redirects parent's handlers right after instantiation or setParent() invokation, not just at the parse().
XMLFilterImpl| Field Summary | |
|---|---|
protected org.xml.sax.ContentHandler |
contentHandler
|
protected org.xml.sax.DTDHandler |
dtdHandler
|
protected org.xml.sax.EntityResolver |
entityResolver
|
protected org.xml.sax.ErrorHandler |
errorHandler
|
protected org.xml.sax.ext.LexicalHandler |
lexicalHandler
|
protected org.xml.sax.Locator |
locator
|
protected org.apache.commons.logging.Log |
log
|
private org.xml.sax.XMLReader |
parent
|
| Constructor Summary | |
|---|---|
SAX2FilterImpl()
Construct an empty XML filter, with no parent. |
|
SAX2FilterImpl(org.xml.sax.ContentHandler ch)
Try to imply all of the handlers from ContentHandler alone. |
|
SAX2FilterImpl(org.xml.sax.ContentHandler ch,
org.xml.sax.EntityResolver er,
org.xml.sax.ErrorHandler eh,
org.xml.sax.ext.LexicalHandler lh,
org.xml.sax.DTDHandler dh)
Construct an XML filter with the specified children handlers. |
|
SAX2FilterImpl(org.xml.sax.XMLReader parent)
Construct an XML filter with the specified parent. |
|
| Method Summary | |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Filter a character data event. |
void |
comment(char[] ch,
int start,
int length)
Filter comment event. |
void |
endCDATA()
Filter endCDATA event. |
void |
endDocument()
Filter an end document event. |
void |
endDTD()
Filter endDTD event |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Filter an end element event. |
void |
endEntity(java.lang.String name)
Filter endEntity event. |
void |
endPrefixMapping(java.lang.String prefix)
Filter an end Namespace prefix mapping event. |
void |
error(org.xml.sax.SAXParseException e)
Filter an error event. |
void |
fatalError(org.xml.sax.SAXParseException e)
Filter a fatal error event. |
org.xml.sax.ContentHandler |
getContentHandler()
Get the content event handler. |
org.xml.sax.DTDHandler |
getDTDHandler()
Get the current DTD event handler. |
org.xml.sax.EntityResolver |
getEntityResolver()
Get the current entity resolver. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Get the current error event handler. |
boolean |
getFeature(java.lang.String name)
Look up the state of a feature. |
org.xml.sax.XMLReader |
getParent()
Get the parent reader. |
java.lang.Object |
getProperty(java.lang.String name)
Look up the value of a property. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Filter an ignorable whitespace event. |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Filter a notation declaration event. |
void |
parse(org.xml.sax.InputSource input)
Parse a document. |
void |
parse(java.lang.String systemId)
Parse a document. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Filter a processing instruction event. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Filter an external entity resolution. |
void |
setAllHandlers(org.xml.sax.ContentHandler ch)
Try to imply all of the handlers from ContentHandler alone. |
void |
setContentHandler(org.xml.sax.ContentHandler handler)
Set the content event handler. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Filter a new document locator event. |
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Set the DTD event handler. |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Set the entity resolver. |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Set the error event handler. |
void |
setFeature(java.lang.String name,
boolean state)
Set the state of a feature. |
void |
setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Set the lexical handler. |
void |
setParent(org.xml.sax.XMLReader parent)
Set the parent reader. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set the value of a property. |
private void |
setupParse()
Set up before a parse. |
void |
skippedEntity(java.lang.String name)
Filter a skipped entity event. |
void |
startCDATA()
Filter startCDATA event. |
void |
startDocument()
Filter a start document event. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Filter startDTD event. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Filter a start element event. |
void |
startEntity(java.lang.String name)
Filter startEntity event. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Filter a start Namespace prefix mapping event. |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Filter an unparsed entity declaration event. |
void |
warning(org.xml.sax.SAXParseException e)
Filter a warning event. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log log
private org.xml.sax.XMLReader parent
protected org.xml.sax.Locator locator
protected org.xml.sax.EntityResolver entityResolver
protected org.xml.sax.DTDHandler dtdHandler
protected org.xml.sax.ContentHandler contentHandler
protected org.xml.sax.ErrorHandler errorHandler
protected org.xml.sax.ext.LexicalHandler lexicalHandler
| Constructor Detail |
|---|
public SAX2FilterImpl()
This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.
XMLReader.setFeature(java.lang.String, boolean),
XMLReader.setProperty(java.lang.String, java.lang.Object)public SAX2FilterImpl(org.xml.sax.XMLReader parent)
setParent(org.xml.sax.XMLReader),
getParent()
public SAX2FilterImpl(org.xml.sax.ContentHandler ch,
org.xml.sax.EntityResolver er,
org.xml.sax.ErrorHandler eh,
org.xml.sax.ext.LexicalHandler lh,
org.xml.sax.DTDHandler dh)
setContentHandler(org.xml.sax.ContentHandler),
setDTDHandler(org.xml.sax.DTDHandler),
setErrorHandler(org.xml.sax.ErrorHandler),
setEntityResolver(org.xml.sax.EntityResolver),
setLexicalHandler(org.xml.sax.ext.LexicalHandler)public SAX2FilterImpl(org.xml.sax.ContentHandler ch)
| Method Detail |
|---|
public void setAllHandlers(org.xml.sax.ContentHandler ch)
public void setParent(org.xml.sax.XMLReader parent)
This is the XMLReader from which
this filter will obtain its events and to which it will pass its
configuration requests. The parent may itself be another filter.
If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail.
setParent in interface org.xml.sax.XMLFilterparent - The parent XML reader.
java.lang.NullPointerException - If the parent is null.getParent()public org.xml.sax.XMLReader getParent()
getParent in interface org.xml.sax.XMLFiltersetParent(org.xml.sax.XMLReader)
public void setFeature(java.lang.String name,
boolean state)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
This will always fail if the parent is null.
setFeature in interface org.xml.sax.XMLReadername - The feature name.state - The requested feature state.
org.xml.sax.SAXNotRecognizedException - When the
XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the
XMLReader recognizes the feature name but
cannot set the requested value.XMLReader.setFeature(java.lang.String, boolean)
public boolean getFeature(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
This will always fail if the parent is null.
getFeature in interface org.xml.sax.XMLReadername - The feature name.
org.xml.sax.SAXNotRecognizedException - When the
XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the
XMLReader recognizes the feature name but
cannot determine its state at this time.XMLReader.getFeature(java.lang.String)
public void setProperty(java.lang.String name,
java.lang.Object value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
This will always fail if the parent is null.
setProperty in interface org.xml.sax.XMLReadername - The property name.value - The requested property value.
org.xml.sax.SAXNotRecognizedException - When the
XMLReader does not recognize the property name.
org.xml.sax.SAXNotSupportedException - When the
XMLReader recognizes the property name but
cannot set the requested value.XMLReader.setProperty(java.lang.String, java.lang.Object)
public java.lang.Object getProperty(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
getProperty in interface org.xml.sax.XMLReadername - The property name.
org.xml.sax.SAXNotRecognizedException - When the
XMLReader does not recognize the feature name.
org.xml.sax.SAXNotSupportedException - When the
XMLReader recognizes the property name but
cannot determine its value at this time.XMLReader.setFeature(java.lang.String, boolean)public void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver in interface org.xml.sax.XMLReaderresolver - The new entity resolver.XMLReader.setEntityResolver(org.xml.sax.EntityResolver)public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver in interface org.xml.sax.XMLReaderXMLReader.getEntityResolver()public void setDTDHandler(org.xml.sax.DTDHandler handler)
setDTDHandler in interface org.xml.sax.XMLReaderhandler - The new DTD handler.XMLReader.setDTDHandler(org.xml.sax.DTDHandler)public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler in interface org.xml.sax.XMLReaderXMLReader.getDTDHandler()public void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler in interface org.xml.sax.XMLReaderhandler - The new content handler.XMLReader.setContentHandler(org.xml.sax.ContentHandler)public org.xml.sax.ContentHandler getContentHandler()
getContentHandler in interface org.xml.sax.XMLReaderXMLReader.getContentHandler()public void setErrorHandler(org.xml.sax.ErrorHandler handler)
setErrorHandler in interface org.xml.sax.XMLReaderhandler - The new error handler.XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
handler - The new lexical handler.public org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler in interface org.xml.sax.XMLReaderXMLReader.getErrorHandler()
public void parse(org.xml.sax.InputSource input)
throws org.xml.sax.SAXException,
java.io.IOException
parse in interface org.xml.sax.XMLReaderinput - The input source for the document entity.
org.xml.sax.SAXException - Any SAX exception, possibly
wrapping another exception.
java.io.IOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.XMLReader.parse(org.xml.sax.InputSource)
public void parse(java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
parse in interface org.xml.sax.XMLReadersystemId - The system identifier as a fully-qualified URI.
org.xml.sax.SAXException - Any SAX exception, possibly
wrapping another exception.
java.io.IOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.XMLReader.parse(java.lang.String)
public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
startDTD in interface org.xml.sax.ext.LexicalHandlername - The document type name.publicId - The declared public identifier for the
external DTD subset, or null if none was declared.systemId - The declared system identifier for the
external DTD subset, or null if none was declared.
org.xml.sax.SAXException - The application may raise an
exception.endDTD(),
startEntity(java.lang.String)
public void endDTD()
throws org.xml.sax.SAXException
endDTD in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
startEntity in interface org.xml.sax.ext.LexicalHandlername - The name of the entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.SAXException - The application may raise an exception.endEntity(java.lang.String),
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String),
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
endEntity in interface org.xml.sax.ext.LexicalHandlername - The name of the entity that is ending.
org.xml.sax.SAXException - The application may raise an exception.startEntity(java.lang.String)
public void startCDATA()
throws org.xml.sax.SAXException
startCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - The application may raise an exception.endCDATA()
public void endCDATA()
throws org.xml.sax.SAXException
endCDATA in interface org.xml.sax.ext.LexicalHandlerorg.xml.sax.SAXException - The application may raise an exception.startCDATA()
public void comment(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
comment in interface org.xml.sax.ext.LexicalHandlerch - An array holding the characters in the comment.start - The starting position in the array.length - The number of characters to use from the array.
org.xml.sax.SAXException - The application may raise an exception.
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
resolveEntity in interface org.xml.sax.EntityResolverpublicId - The entity's public identifier, or null.systemId - The entity's system identifier.
org.xml.sax.SAXException - The client may throw
an exception during processing.
java.io.IOException - The client may throw an
I/O-related exception while obtaining the
new InputSource.EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public void notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
notationDecl in interface org.xml.sax.DTDHandlername - The notation name.publicId - The notation's public identifier, or null.systemId - The notation's system identifier, or null.
org.xml.sax.SAXException - The client may throw
an exception during processing.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
throws org.xml.sax.SAXException
unparsedEntityDecl in interface org.xml.sax.DTDHandlername - The entity name.publicId - The entity's public identifier, or null.systemId - The entity's system identifier, or null.notationName - The name of the associated notation.
org.xml.sax.SAXException - The client may throw
an exception during processing.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator in interface org.xml.sax.ContentHandlerlocator - The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.startDocument()
public void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerorg.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.endDocument()
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerprefix - The Namespace prefix.uri - The Namespace URI.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
endPrefixMapping in interface org.xml.sax.ContentHandlerprefix - The Namespace prefix.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandleruri - The element's Namespace URI, or the empty string.localName - The element's local name, or the empty string.qName - The element's qualified (prefixed) name, or the empty
string.atts - The element's attributes.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandleruri - The element's Namespace URI, or the empty string.localName - The element's local name, or the empty string.qName - The element's qualified (prefixed) name, or the empty
string.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlerch - An array of characters.start - The starting position in the array.length - The number of characters to use from the array.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerch - An array of characters.start - The starting position in the array.length - The number of characters to use from the array.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlertarget - The processing instruction target.data - The text following the target.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlername - The name of the skipped entity.
org.xml.sax.SAXException - The client may throw
an exception during processing.ContentHandler.skippedEntity(java.lang.String)
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
warning in interface org.xml.sax.ErrorHandlere - The nwarning as an exception.
org.xml.sax.SAXException - The client may throw
an exception during processing.ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
error in interface org.xml.sax.ErrorHandlere - The error as an exception.
org.xml.sax.SAXException - The client may throw
an exception during processing.ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlere - The error as an exception.
org.xml.sax.SAXException - The client may throw
an exception during processing.ErrorHandler.fatalError(org.xml.sax.SAXParseException)private void setupParse()
Before every parse, check whether the parent is non-null, and re-register the filter for all of the events.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||