Devsphere.com


com.devsphere.xml.saxdomix.helpers
Class ResultFilter

java.lang.Object
  |
  +--com.devsphere.xml.saxdomix.helpers.ResultFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class ResultFilter
extends java.lang.Object
implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

This is a filter for SAX events used by SDXTransformer.


Field Summary
protected  javax.xml.transform.sax.TransformerHandler serializer
          The serializer that receives the filtered events
 
Constructor Summary
ResultFilter(javax.xml.transform.sax.TransformerHandler serializer)
          Creates a new filter.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Forwards the SAX event to the serializer object.
 void comment(char[] ch, int start, int length)
          Forwards the SAX event to the serializer object.
 void endCDATA()
          Forwards the SAX event to the serializer object.
 void endDocument()
          Ignores the SAX event.
 void endDTD()
          Ignores the SAX event.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)
          Forwards the SAX event to the serializer object.
 void endEntity(java.lang.String name)
          Forwards the SAX event to the serializer object.
 void endPrefixMapping(java.lang.String prefix)
          Forwards the SAX event to the serializer object.
 void ignorableWhitespace(char[] ch, int start, int length)
          Forwards the SAX event to the serializer object.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Forwards the SAX event to the serializer object.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Ignores the SAX event.
 void skippedEntity(java.lang.String name)
          Forwards the SAX event to the serializer object.
 void startCDATA()
          Forwards the SAX event to the serializer object.
 void startDocument()
          Ignores the SAX event.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Ignores the SAX event.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
          Forwards the SAX event to the serializer object.
 void startEntity(java.lang.String name)
          Forwards the SAX event to the serializer object.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Forwards the SAX event to the serializer object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serializer

protected javax.xml.transform.sax.TransformerHandler serializer
The serializer that receives the filtered events

Constructor Detail

ResultFilter

public ResultFilter(javax.xml.transform.sax.TransformerHandler serializer)
Creates a new filter.

Parameters:
serializer - Object that receives the filtered events
Method Detail

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Ignores the SAX event.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - The SAX Locator object

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Ignores the SAX event.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Ignores the SAX event.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - The namespace prefix.
uri - The namespace URI the prefix is mapped to.
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - The namespace prefix.
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qualifiedName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - The element's namespace URI
localName - The element's local name
qualifiedName - The element's qualified name
attributes - The element's attributes
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qualifiedName)
                throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - The element's namespace URI
localName - The element's local name
qualifiedName - The element's qualified name
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - The characters from the XML document
start - The start position in the array
length - The number of characters to get from the array
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
ch - The characters from the XML document
start - The start position in the array
length - The number of characters to get from the array
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
target - The target of the processing instruction.
data - The data of the processing instruction.
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
name - The name of an entity
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

startDTD

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

Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The name of the document's root element.
publicId - The public identifier of the external DTD
systemId - The system identifier of the external DTD
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Ignores the SAX event.

Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The name of an entity
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
Parameters:
name - The name of an entity
Throws:
org.xml.sax.SAXException - Cannot be thrown since the method does nothing

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Forwards the SAX event to the serializer object.

Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
Parameters:
ch - An array holding the characters in the comment
start - The start position in the array
length - The number of characters to get from the array
Throws:
org.xml.sax.SAXException - Error reported by the serializer's method

 Devsphere.com