com.openharbor.beck.receive
Class DefaultXMLReceiver

java.lang.Object
  extended bycom.openharbor.beck.receive.DefaultXMLReceiver
All Implemented Interfaces:
MapFromXML.Aware, XMLReceiver
Direct Known Subclasses:
OHXHandler

public class DefaultXMLReceiver
extends java.lang.Object
implements XMLReceiver, MapFromXML.Aware

Traverses the XML document tree in document order (as it comes from a SAX parser). Allocates an Unmarshaller to each XML element.


Field Summary
protected  org.apache.commons.logging.Log log
           
protected  java.util.Stack unmarshallerStack
          The current state of XML document traversal, represented as a stack of the unmarshallers allocated to the current element, its enclosing element, its enclosing element and so on to the root element (whose Unmarshaller is at the bottom of this stack).
 
Constructor Summary
DefaultXMLReceiver()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void clear()
          Release all resources and subsequently behave as though newly constructed.
 void endElement()
           
protected  java.util.Map getDocumentState()
           
 MapFromXML getMapFromXML()
           
protected  Prefixer getPrefixer()
           
 java.lang.Object getResult()
           
protected  XMLContext getXMLContext()
           
protected  void recycleDanglingReferences()
          Log warnings about any cross-references that were not resolved.
protected  void resolveDocumentReferences()
          Resolve XPaths, after the rest of the document has been copied to Java.
 void setMapFromXML(MapFromXML mapper)
           
 void setXMLContext(XMLContext context)
           
 void startElement(XMLThing element)
           
protected  Unmarshaller startObject(Unmarshaller parent, XMLThing source)
          Start constructing a Java object from an element of an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log

unmarshallerStack

protected java.util.Stack unmarshallerStack
The current state of XML document traversal, represented as a stack of the unmarshallers allocated to the current element, its enclosing element, its enclosing element and so on to the root element (whose Unmarshaller is at the bottom of this stack).

Constructor Detail

DefaultXMLReceiver

public DefaultXMLReceiver()
Method Detail

getMapFromXML

public MapFromXML getMapFromXML()
Specified by:
getMapFromXML in interface MapFromXML.Aware

setMapFromXML

public void setMapFromXML(MapFromXML mapper)
Specified by:
setMapFromXML in interface MapFromXML.Aware

getXMLContext

protected XMLContext getXMLContext()

setXMLContext

public void setXMLContext(XMLContext context)
Specified by:
setXMLContext in interface XMLReceiver

getDocumentState

protected java.util.Map getDocumentState()

clear

public void clear()
Description copied from interface: XMLReceiver
Release all resources and subsequently behave as though newly constructed.

Specified by:
clear in interface XMLReceiver

startElement

public void startElement(XMLThing element)
                  throws java.lang.Exception
Specified by:
startElement in interface XMLReceiver
Throws:
java.lang.Exception

getPrefixer

protected Prefixer getPrefixer()

startObject

protected Unmarshaller startObject(Unmarshaller parent,
                                   XMLThing source)
                            throws java.lang.Exception
Start constructing a Java object from an element of an XML document.

Returns:
the Unmarshaller allocated to this element.
Throws:
java.lang.Exception

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws java.lang.Exception
Specified by:
characters in interface XMLReceiver
Throws:
java.lang.Exception

endElement

public void endElement()
                throws java.lang.Exception
Specified by:
endElement in interface XMLReceiver
Throws:
java.lang.Exception

resolveDocumentReferences

protected void resolveDocumentReferences()
Resolve XPaths, after the rest of the document has been copied to Java.


recycleDanglingReferences

protected void recycleDanglingReferences()
Log warnings about any cross-references that were not resolved.


getResult

public java.lang.Object getResult()
Specified by:
getResult in interface XMLReceiver
Returns:
the Java object that was unmarshalled from the XML document.