uPortal 2.4.1
API Documentation

org.jasig.portal.utils
Class SAX2DuplicatingFilterImpl

java.lang.Object
  extended byorg.jasig.portal.utils.SAX2FilterImpl
      extended byorg.jasig.portal.utils.SAX2DuplicatingFilterImpl
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class SAX2DuplicatingFilterImpl
extends 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().

See Also:
XMLFilterImpl

Constructor Summary
SAX2DuplicatingFilterImpl()
          Construct an empty XML filter, with no parent.
SAX2DuplicatingFilterImpl(org.xml.sax.ContentHandler ch, org.xml.sax.ContentHandler ch2)
          Try to imply all of the handlers from ContentHandler alone.
SAX2DuplicatingFilterImpl(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, org.xml.sax.ContentHandler ch2, org.xml.sax.EntityResolver er2, org.xml.sax.ErrorHandler eh2, org.xml.sax.ext.LexicalHandler lh2, org.xml.sax.DTDHandler dh2)
          Construct an XML filter with the specified children handlers.
SAX2DuplicatingFilterImpl(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 getContentHandler2()
          Get the content event handler.
 org.xml.sax.DTDHandler getDTDHandler2()
          Get the current DTD event handler.
 org.xml.sax.ErrorHandler getErrorHandler2()
          Get the current error event handler.
 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 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, org.xml.sax.ContentHandler ch2)
          Try to imply all of the handlers from ContentHandler alone.
 void setContentHandler2(org.xml.sax.ContentHandler handler)
          Set the content event handler.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Filter a new document locator event.
 void setDTDHandler2(org.xml.sax.DTDHandler handler)
          Set the DTD event handler.
 void setErrorHandler2(org.xml.sax.ErrorHandler handler)
          Set the error event handler.
 void setLexicalHandler2(org.xml.sax.ext.LexicalHandler handler)
          Set the lexical handler.
 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 org.jasig.portal.utils.SAX2FilterImpl
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, parse, parse, setAllHandlers, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setLexicalHandler, setParent, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAX2DuplicatingFilterImpl

public SAX2DuplicatingFilterImpl()
Construct an empty XML filter, with no parent.

This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.

See Also:
XMLReader.setFeature(java.lang.String, boolean), XMLReader.setProperty(java.lang.String, java.lang.Object)

SAX2DuplicatingFilterImpl

public SAX2DuplicatingFilterImpl(org.xml.sax.XMLReader parent)
Construct an XML filter with the specified parent.

See Also:
SAX2FilterImpl.setParent(XMLReader), SAX2FilterImpl.getParent()

SAX2DuplicatingFilterImpl

public SAX2DuplicatingFilterImpl(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,
                                 org.xml.sax.ContentHandler ch2,
                                 org.xml.sax.EntityResolver er2,
                                 org.xml.sax.ErrorHandler eh2,
                                 org.xml.sax.ext.LexicalHandler lh2,
                                 org.xml.sax.DTDHandler dh2)
Construct an XML filter with the specified children handlers.

See Also:
SAX2FilterImpl.setContentHandler(ContentHandler), SAX2FilterImpl.setDTDHandler(DTDHandler), SAX2FilterImpl.setErrorHandler(ErrorHandler), SAX2FilterImpl.setEntityResolver(EntityResolver), SAX2FilterImpl.setLexicalHandler(LexicalHandler)

SAX2DuplicatingFilterImpl

public SAX2DuplicatingFilterImpl(org.xml.sax.ContentHandler ch,
                                 org.xml.sax.ContentHandler ch2)
Try to imply all of the handlers from ContentHandler alone.

Method Detail

setAllHandlers

public void setAllHandlers(org.xml.sax.ContentHandler ch,
                           org.xml.sax.ContentHandler ch2)
Try to imply all of the handlers from ContentHandler alone.


setDTDHandler2

public void setDTDHandler2(org.xml.sax.DTDHandler handler)
Set the DTD event handler.

Parameters:
handler - The new DTD handler.
See Also:
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)

getDTDHandler2

public org.xml.sax.DTDHandler getDTDHandler2()
Get the current DTD event handler.

Returns:
The current DTD handler, or null if none was set.
See Also:
XMLReader.getDTDHandler()

setContentHandler2

public void setContentHandler2(org.xml.sax.ContentHandler handler)
Set the content event handler.

Parameters:
handler - The new content handler.
See Also:
XMLReader.setContentHandler(org.xml.sax.ContentHandler)

getContentHandler2

public org.xml.sax.ContentHandler getContentHandler2()
Get the content event handler.

Returns:
The current content handler, or null if none was set.
See Also:
XMLReader.getContentHandler()

setErrorHandler2

public void setErrorHandler2(org.xml.sax.ErrorHandler handler)
Set the error event handler.

Parameters:
handler - The new error handler.
See Also:
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)

setLexicalHandler2

public void setLexicalHandler2(org.xml.sax.ext.LexicalHandler handler)
Set the lexical handler.

Parameters:
handler - The new lexical handler.

getErrorHandler2

public org.xml.sax.ErrorHandler getErrorHandler2()
Get the current error event handler.

Returns:
The current error handler, or null if none was set.
See Also:
XMLReader.getErrorHandler()

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws org.xml.sax.SAXException
Filter startDTD event.

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Overrides:
startDTD in class SAX2FilterImpl
Parameters:
name - 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.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endDTD(), startEntity(java.lang.String)

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Filter endDTD event

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
Overrides:
endDTD in class SAX2FilterImpl
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startDTD(java.lang.String, java.lang.String, java.lang.String)

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Filter startEntity event.

Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Overrides:
startEntity in class SAX2FilterImpl
Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endEntity(java.lang.String), DeclHandler.internalEntityDecl(java.lang.String, java.lang.String), DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Filter endEntity event.

Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Overrides:
endEntity in class SAX2FilterImpl
Parameters:
name - The name of the entity that is ending.
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startEntity(java.lang.String)

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Filter startCDATA event.

Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
Overrides:
startCDATA in class SAX2FilterImpl
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
endCDATA()

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Filter endCDATA event.

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
Overrides:
endCDATA in class SAX2FilterImpl
Throws:
org.xml.sax.SAXException - The application may raise an exception.
See Also:
startCDATA()

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Filter comment event.

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Overrides:
comment in class SAX2FilterImpl
Parameters:
ch - 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.
Throws:
org.xml.sax.SAXException - The application may raise an exception.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Filter an external entity resolution.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class SAX2FilterImpl
Parameters:
publicId - The entity's public identifier, or null.
systemId - The entity's system identifier.
Returns:
A new InputSource or null for the default.
Throws:
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.
See Also:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws org.xml.sax.SAXException
Filter a notation declaration event.

Specified by:
notationDecl in interface org.xml.sax.DTDHandler
Overrides:
notationDecl in class SAX2FilterImpl
Parameters:
name - The notation name.
publicId - The notation's public identifier, or null.
systemId - The notation's system identifier, or null.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notationName)
                        throws org.xml.sax.SAXException
Filter an unparsed entity declaration event.

Specified by:
unparsedEntityDecl in interface org.xml.sax.DTDHandler
Overrides:
unparsedEntityDecl in class SAX2FilterImpl
Parameters:
name - 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.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Filter a new document locator event.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class SAX2FilterImpl
Parameters:
locator - The document locator.
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Filter a start document event.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class SAX2FilterImpl
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Filter an end document event.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class SAX2FilterImpl
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endDocument()

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Filter a start Namespace prefix mapping event.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
startPrefixMapping in class SAX2FilterImpl
Parameters:
prefix - The Namespace prefix.
uri - The Namespace URI.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Filter an end Namespace prefix mapping event.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
endPrefixMapping in class SAX2FilterImpl
Parameters:
prefix - The Namespace prefix.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startElement

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
Filter a start element event.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class SAX2FilterImpl
Parameters:
uri - 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.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Filter an end element event.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class SAX2FilterImpl
Parameters:
uri - 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.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Filter a character data event.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class SAX2FilterImpl
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Filter an ignorable whitespace event.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Overrides:
ignorableWhitespace in class SAX2FilterImpl
Parameters:
ch - An array of characters.
start - The starting position in the array.
length - The number of characters to use from the array.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Filter a processing instruction event.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Overrides:
processingInstruction in class SAX2FilterImpl
Parameters:
target - The processing instruction target.
data - The text following the target.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Filter a skipped entity event.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Overrides:
skippedEntity in class SAX2FilterImpl
Parameters:
name - The name of the skipped entity.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ContentHandler.skippedEntity(java.lang.String)

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Filter a warning event.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class SAX2FilterImpl
Parameters:
e - The nwarning as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Filter an error event.

Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class SAX2FilterImpl
Parameters:
e - The error as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Filter a fatal error event.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class SAX2FilterImpl
Parameters:
e - The error as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

uPortal 2.4.1
API Documentation