org.jabber.jabberbeans.sax.Extension
Class SerializingHandler

java.lang.Object
  |
  +--org.jabber.jabberbeans.sax.SubHandler
        |
        +--org.jabber.jabberbeans.sax.Extension.SerializingHandler

public class SerializingHandler
extends SubHandler

Handler class to build DefaultExtension objects (objects without a supplied custom handler). This serializes the data back out to equivalent XML

Version:
$Revision: 1.1.1.1 $
Author:
David Waite <dwaite@jabber.com>, $Author: lucky $

Field Summary
private  java.lang.StringBuffer accumulated
          buffer for accumulated characters while parsing the 'packet'
private  java.lang.String element
          slot for the base elemnt name
private  java.lang.String xmlns
          slot for storing the namespace of the object
 
Fields inherited from class org.jabber.jabberbeans.sax.SubHandler
handlerFactory, parent, parser, subCount
 
Constructor Summary
SerializingHandler()
          Creates a new SerializingHandler instance.
 
Method Summary
 void characters(char[] ch, int start, int length)
          This is an exact copy of the characters function in the main handler
 void handleEndElement(java.lang.String name)
          This is an exact copy of the end element in the main handler
 void handleStartElement(java.lang.String name, AttributeList attributes)
          This is an exact copy of the start element in the main handler.
 void receiveChildData(SubHandler subHandler, java.lang.Object data)
          received data handler from subobjects.
 void reset()
          reset the handler to a default state, for possible reuse.
 void startHandler(java.lang.String name, AttributeList attributes)
          Gets called when the underlying engine decides to pass an entity and all sub-entities off to your subhandler.
 java.lang.Object stopHandler(java.lang.String name)
          Stophandler is the same as end element, except that it is called saying that the subhandler is no longer in scope.
 
Methods inherited from class org.jabber.jabberbeans.sax.SubHandler
endDocument, endElement, getHandlerFactory, getSubCount, graftParent, graftSubHandler, ignorableWhitespace, processingInstruction, setChildSubHandler, setDocumentLocator, setHandlerFactory, setParent, setParser, startDocument, startElement
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

accumulated

private java.lang.StringBuffer accumulated
buffer for accumulated characters while parsing the 'packet'

element

private java.lang.String element
slot for the base elemnt name

xmlns

private java.lang.String xmlns
slot for storing the namespace of the object
Constructor Detail

SerializingHandler

public SerializingHandler()
Creates a new SerializingHandler instance.
Method Detail

startHandler

public void startHandler(java.lang.String name,
                         AttributeList attributes)
                  throws SAXException
Gets called when the underlying engine decides to pass an entity and all sub-entities off to your subhandler.

Upon seeing the element that this subhandler handles, we call this constructor, passing in the attributes.

Overrides:
startHandler in class SubHandler
Parameters:
attributes - a value of type 'AttributeList'

handleStartElement

public void handleStartElement(java.lang.String name,
                               AttributeList attributes)
                        throws SAXException
This is an exact copy of the start element in the main handler.
Overrides:
handleStartElement in class SubHandler
Parameters:
name - string that holds the element name
attributes - AttributeList of attributes going with this element
Throws:
SAXException - thrown on error (unexpected element)

handleEndElement

public void handleEndElement(java.lang.String name)
                      throws SAXException
This is an exact copy of the end element in the main handler
Overrides:
handleEndElement in class SubHandler
Parameters:
name - string holding the element name
Throws:
SAXException - thrown on error

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
This is an exact copy of the characters function in the main handler
Overrides:
characters in class SubHandler
Parameters:
ch - character string detected
start - start position
length - length of string
Throws:
SAXException - thrown on error

stopHandler

public java.lang.Object stopHandler(java.lang.String name)
                             throws SAXException
Stophandler is the same as end element, except that it is called saying that the subhandler is no longer in scope.
Overrides:
stopHandler in class SubHandler
Parameters:
nil - a value of type ''

reset

public void reset()
reset the handler to a default state, for possible reuse.

receiveChildData

public void receiveChildData(SubHandler subHandler,
                             java.lang.Object data)
received data handler from subobjects. Ignored since this handler never creates child handlers
Overrides:
receiveChildData in class SubHandler
Parameters:
subHandler - child subhandler which is returning
data - Object which the child is returning