tomp.xtcl.filter
Class DynamicMultiFilterImpl

java.lang.Object
  extended bytomp.xtcl.filter.XTFilterImpl
      extended bytomp.xtcl.filter.DynamicMultiFilterImpl
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, DynamicMultiFilter, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, HasOutputProperties, org.xml.sax.ext.LexicalHandler, Parametrized, org.xml.sax.XMLFilter, org.xml.sax.XMLReader, XTFilter
Direct Known Subclasses:
MyMultiFilter

public class DynamicMultiFilterImpl
extends XTFilterImpl
implements DynamicMultiFilter


Field Summary
protected  java.util.List filters
           
protected  org.xml.sax.XMLFilter firstFilter
           
protected  boolean isContentHandler
           
protected  boolean isDTDHandler
           
protected  boolean isEntityResolver
           
protected  boolean isErrorHandler
           
protected  boolean isLexicalHandler
           
protected  org.xml.sax.XMLFilter lastFilter
           
protected  HasOutputProperties outputPropertiesListener
           
 
Fields inherited from class tomp.xtcl.filter.XTFilterImpl
contentHandler, dtdHandler, entityResolver, errorHandler, lexicalHandler, locator, parent
 
Constructor Summary
DynamicMultiFilterImpl()
           
DynamicMultiFilterImpl(org.xml.sax.XMLReader parent)
           
 
Method Summary
 void addFilter(int pos, org.xml.sax.XMLFilter f)
           
 void comment(char[] ch, int start, int length)
          Callback interface for SAX (part of LexicalHandler interface): not for application use
protected static void connectHandlers(org.xml.sax.XMLReader parent, org.xml.sax.XMLFilter f)
           
protected static void copyHandlers(org.xml.sax.XMLReader from, org.xml.sax.XMLReader to)
           
protected  void determineHandlerInfo()
           
 void endCDATA()
           
 void endDocument()
          Filter an end document event.
 void endDTD()
          Register the end of the DTD.
 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)
           
 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 value of a feature.
 org.xml.sax.XMLFilter getFilter(int pos)
           
 int getFilterCount()
           
 java.util.Properties getOutputProperties()
           
 java.lang.Object getProperty(java.lang.String name)
          Look up the value of a property.
 void characters(char[] ch, int start, int length)
          Filter a character data event.
 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 processingInstruction(java.lang.String target, java.lang.String data)
          Filter a processing instruction event.
 void removeFilter(int pos)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Filter an external entity resolution.
 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 value)
          Set the value of a feature.
 void setFilter(int pos, org.xml.sax.XMLFilter f)
           
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
          Set the lexical event handler.
 void setOutputProperties(java.util.Properties p)
           
 void setOutputPropertiesListener(HasOutputProperties l)
           
 void setParent(org.xml.sax.XMLReader parent)
          Set the parent reader.
 void skippedEntity(java.lang.String name)
          Filter a skipped entity event.
 void startCDATA()
           
 void startDocument()
          Filter a start document event.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Register the start of the DTD.
 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)
           
 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 tomp.xtcl.filter.XTFilterImpl
getLexicalHandler, getParent, parse, setParameter, setProperty, setupParse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.XMLFilter
getParent
 
Methods inherited from interface org.xml.sax.XMLReader
parse, setProperty
 
Methods inherited from interface tomp.general.Parametrized
setParameter
 

Field Detail

filters

protected java.util.List filters

firstFilter

protected org.xml.sax.XMLFilter firstFilter

lastFilter

protected org.xml.sax.XMLFilter lastFilter

isContentHandler

protected boolean isContentHandler

isDTDHandler

protected boolean isDTDHandler

isErrorHandler

protected boolean isErrorHandler

isLexicalHandler

protected boolean isLexicalHandler

isEntityResolver

protected boolean isEntityResolver

outputPropertiesListener

protected HasOutputProperties outputPropertiesListener
Constructor Detail

DynamicMultiFilterImpl

public DynamicMultiFilterImpl()

DynamicMultiFilterImpl

public DynamicMultiFilterImpl(org.xml.sax.XMLReader parent)
Method Detail

setParent

public void setParent(org.xml.sax.XMLReader parent)
Description copied from class: XTFilterImpl
Set the parent reader.

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.

Specified by:
setParent in interface org.xml.sax.XMLFilter
Overrides:
setParent in class XTFilterImpl
Parameters:
parent - The parent XML reader.
See Also:
XTFilterImpl.getParent()

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Description copied from class: XTFilterImpl
Set the value of a feature.

This will always fail if the parent is null.

Specified by:
setFeature in interface org.xml.sax.XMLReader
Overrides:
setFeature in class XTFilterImpl
Parameters:
name - The feature name.
value - The requested feature value.
Throws:
org.xml.sax.SAXNotRecognizedException - If the feature value can't be assigned or retrieved from the parent.
org.xml.sax.SAXNotSupportedException - When the parent recognizes the feature name but cannot set the requested value.

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Description copied from class: XTFilterImpl
Look up the value of a feature.

This will always fail if the parent is null.

Specified by:
getFeature in interface org.xml.sax.XMLReader
Overrides:
getFeature in class XTFilterImpl
Parameters:
name - The feature name.
Returns:
The current value of the feature.
Throws:
org.xml.sax.SAXNotRecognizedException - If the feature value can't be assigned or retrieved from the parent.
org.xml.sax.SAXNotSupportedException - When the parent recognizes the feature name but cannot determine its value at this time.

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Look up the value of a property.

Specified by:
getProperty in interface org.xml.sax.XMLReader
Overrides:
getProperty in class XTFilterImpl
Parameters:
name - The property name.
Returns:
The current value of the property.
Throws:
org.xml.sax.SAXNotRecognizedException - If the property value can't be assigned or retrieved from the parent.
org.xml.sax.SAXNotSupportedException - When the parent recognizes the property name but cannot determine its value at this time.

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Set the entity resolver.

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader
Overrides:
setEntityResolver in class XTFilterImpl
Parameters:
resolver - The new entity resolver.

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Get the current entity resolver.

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Overrides:
getEntityResolver in class XTFilterImpl
Returns:
The current entity resolver, or null if none was set.

setDTDHandler

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

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader
Overrides:
setDTDHandler in class XTFilterImpl

getDTDHandler

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

Specified by:
getDTDHandler in interface org.xml.sax.XMLReader
Overrides:
getDTDHandler in class XTFilterImpl
Returns:
The current DTD handler, or null if none was set.

setContentHandler

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

Specified by:
setContentHandler in interface org.xml.sax.XMLReader
Overrides:
setContentHandler in class XTFilterImpl

getContentHandler

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

Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Overrides:
getContentHandler in class XTFilterImpl
Returns:
The current content handler, or null if none was set.

setErrorHandler

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

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader
Overrides:
setErrorHandler in class XTFilterImpl

getErrorHandler

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

Specified by:
getErrorHandler in interface org.xml.sax.XMLReader
Overrides:
getErrorHandler in class XTFilterImpl
Returns:
The current error handler, or null if none was set.

parse

public void parse(org.xml.sax.InputSource input)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Parse a document.

Specified by:
parse in interface org.xml.sax.XMLReader
Overrides:
parse in class XTFilterImpl
Parameters:
input - The input source for the document entity.
Throws:
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.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
Parameters:
locator - The document 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 XTFilterImpl
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Parameters:
prefix - The Namespace prefix.
uri - The Namespace URI.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Parameters:
prefix - The Namespace prefix.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
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.

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 XTFilterImpl
Parameters:
name - The name of the skipped entity.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Parameters:
e - The warning as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Parameters:
e - The error as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

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 XTFilterImpl
Parameters:
e - The error as an exception.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Callback interface for SAX (part of LexicalHandler interface): not for application use

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Overrides:
comment in class XTFilterImpl
Throws:
org.xml.sax.SAXException

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws org.xml.sax.SAXException
Register the start of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Overrides:
startDTD in class XTFilterImpl
Throws:
org.xml.sax.SAXException

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Register the end of the DTD. Comments in the DTD are skipped because they are not part of the XPath data model

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
Overrides:
endDTD in class XTFilterImpl
Throws:
org.xml.sax.SAXException

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Overrides:
startEntity in class XTFilterImpl
Throws:
org.xml.sax.SAXException

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Overrides:
endEntity in class XTFilterImpl
Throws:
org.xml.sax.SAXException

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
Overrides:
startCDATA in class XTFilterImpl
Throws:
org.xml.sax.SAXException

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
Overrides:
endCDATA in class XTFilterImpl
Throws:
org.xml.sax.SAXException

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Description copied from class: XTFilterImpl
Set the lexical event handler.

Overrides:
setLexicalHandler in class XTFilterImpl
Parameters:
handler - The new lexical handler.

setFilter

public void setFilter(int pos,
                      org.xml.sax.XMLFilter f)
               throws org.xml.sax.SAXException
Specified by:
setFilter in interface DynamicMultiFilter
Throws:
org.xml.sax.SAXException

addFilter

public void addFilter(int pos,
                      org.xml.sax.XMLFilter f)
               throws org.xml.sax.SAXException
Specified by:
addFilter in interface DynamicMultiFilter
Throws:
org.xml.sax.SAXException

removeFilter

public void removeFilter(int pos)
                  throws org.xml.sax.SAXException
Specified by:
removeFilter in interface DynamicMultiFilter
Throws:
org.xml.sax.SAXException

determineHandlerInfo

protected void determineHandlerInfo()

connectHandlers

protected static void connectHandlers(org.xml.sax.XMLReader parent,
                                      org.xml.sax.XMLFilter f)

copyHandlers

protected static void copyHandlers(org.xml.sax.XMLReader from,
                                   org.xml.sax.XMLReader to)

getFilter

public org.xml.sax.XMLFilter getFilter(int pos)
Specified by:
getFilter in interface DynamicMultiFilter

getOutputProperties

public java.util.Properties getOutputProperties()
Specified by:
getOutputProperties in interface HasOutputProperties

setOutputProperties

public void setOutputProperties(java.util.Properties p)
Specified by:
setOutputProperties in interface HasOutputProperties

setOutputPropertiesListener

public void setOutputPropertiesListener(HasOutputProperties l)
Specified by:
setOutputPropertiesListener in interface HasOutputProperties

getFilterCount

public int getFilterCount()
Specified by:
getFilterCount in interface DynamicMultiFilter