org.apache.commons.jelly.util
Class SafeContentHandler

java.lang.Object
  extended by org.apache.commons.jelly.util.SafeContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler

public class SafeContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler

Ensures that only one start and end document event is passed onto the underlying ContentHandler. This object can only be used once and then discarded.

Author:
James Strachan

Field Summary
private  boolean documentEnded
           
private  boolean documentStarted
           
private  org.xml.sax.ContentHandler handler
           
 
Constructor Summary
SafeContentHandler(org.xml.sax.ContentHandler handler)
           
 
Method Summary
 void characters(char[] arg0, int arg1, int arg2)
           
 void endDocument()
           
 void endElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
           
 void endPrefixMapping(java.lang.String arg0)
           
 void ignorableWhitespace(char[] arg0, int arg1, int arg2)
           
 void processingInstruction(java.lang.String arg0, java.lang.String arg1)
           
 void setDocumentLocator(org.xml.sax.Locator arg0)
           
 void skippedEntity(java.lang.String arg0)
           
 void startDocument()
           
 void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, org.xml.sax.Attributes arg3)
           
 void startPrefixMapping(java.lang.String arg0, java.lang.String arg1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

private org.xml.sax.ContentHandler handler

documentStarted

private boolean documentStarted

documentEnded

private boolean documentEnded
Constructor Detail

SafeContentHandler

public SafeContentHandler(org.xml.sax.ContentHandler handler)
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] arg0,
                       int arg1,
                       int arg2)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
arg2 -
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String arg0,
                       java.lang.String arg1,
                       java.lang.String arg2)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
arg2 -
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String arg0)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] arg0,
                                int arg1,
                                int arg2)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
arg2 -
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String arg0,
                                  java.lang.String arg1)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
Throws:
org.xml.sax.SAXException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator arg0)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
arg0 -

skippedEntity

public void skippedEntity(java.lang.String arg0)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String arg0,
                         java.lang.String arg1,
                         java.lang.String arg2,
                         org.xml.sax.Attributes arg3)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
arg2 -
arg3 -
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String arg0,
                               java.lang.String arg1)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
arg0 -
arg1 -
Throws:
org.xml.sax.SAXException