de.ispsoft.jaxme
Class JMContentHandler

java.lang.Object
  extended byde.ispsoft.jaxme.ObservedHandlerImpl
      extended byde.ispsoft.jaxme.JMContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, ObservedHandler

public class JMContentHandler
extends ObservedHandlerImpl

A SAX ContentHandler that reads an XML document. The implementation works as follows: The JMContentHandler can operate as an "outer" ContentHandler which manages a stack of other JMContentHandlers, the "inner" ContentHandlers. Most of these "inner" ContentHandlers are passive (that is, they remain on the stack, doing nothing), with the exception of the innermost ContentHandler who is active and reading a single element.

If the innermost ContentHandler encounters any child elements, it will make itself passive by pushing a new JMContentHandler on the stack which reads the innermost element. Likewise, if the innermost ContentHandler has read its element, it will pop itself from the stack, making the next ContentHandler active.

Author:
Jochen Wiedmann

Field Summary
protected  ObservedHandler currentContentHandler
           
protected  java.lang.String currentContext
           
protected  JMAnyElement currentElement
           
 
Fields inherited from class de.ispsoft.jaxme.ObservedHandlerImpl
context, level, locator, observer, resultCollection, resultNode
 
Constructor Summary
JMContentHandler()
          Creates a new instance of JMContentHandler
 
Method Summary
 void characters(char[] pChars, int pStart, int pLen)
           
 void endElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName)
           
 void endPrefixMapping(java.lang.String pPrefix)
           
 boolean getAddWhitespace()
          Returns whether trailing or prepending whitespace should be added as an unknown child.
 UnmarshallerImpl getUnmarshaller()
           
 void ignorableWhitespace(char[] pChars, int pStart, int pLen)
           
protected  ObservedHandler newContentHandler(java.lang.String pNamespaceURI, java.lang.String pLocalName)
           
protected  JMAnyElement newResultNode(java.lang.String pNamespaceURI, java.lang.String pLocalName)
           
 void processingInstruction(java.lang.String pTarget, java.lang.String pData)
           
protected  void processResultNode(ObservedHandler pHandler)
           
 void setAddWhitespace(boolean pAddWhitespace)
          Sets whether trailing or prepending whitespace should be added as an unknown child.
 void setDocumentLocator(org.xml.sax.Locator pLocator)
          Sets a document locator.
 void setUnmarshaller(UnmarshallerImpl pUnmarshaller)
           
 void skippedEntity(java.lang.String pEntity)
           
 void startDocument()
          This method is for resetting the ObservedHandlerImpl.
 void startElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttr)
           
 void startPrefixMapping(java.lang.String pPrefix, java.lang.String pNamespaceURI)
           
 
Methods inherited from class de.ispsoft.jaxme.ObservedHandlerImpl
addResultNode, endDocument, getContext, getContext, getObserver, getResultCollection, getResultNode, getSAXException, getSAXException, setContext, setObserver, setResultCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentElement

protected JMAnyElement currentElement

currentContentHandler

protected ObservedHandler currentContentHandler

currentContext

protected java.lang.String currentContext
Constructor Detail

JMContentHandler

public JMContentHandler()
Creates a new instance of JMContentHandler

Method Detail

newResultNode

protected JMAnyElement newResultNode(java.lang.String pNamespaceURI,
                                     java.lang.String pLocalName)
                              throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

newContentHandler

protected ObservedHandler newContentHandler(java.lang.String pNamespaceURI,
                                            java.lang.String pLocalName)
                                     throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

processResultNode

protected void processResultNode(ObservedHandler pHandler)
                          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: ObservedHandlerImpl

This method is for resetting the ObservedHandlerImpl. Concrete subclasses should call this from within their own startDocument() methods.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class ObservedHandlerImpl
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String pNamespaceURI,
                         java.lang.String pLocalName,
                         java.lang.String pQName,
                         org.xml.sax.Attributes pAttr)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String pNamespaceURI,
                       java.lang.String pLocalName,
                       java.lang.String pQName)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] pChars,
                                int pStart,
                                int pLen)
                         throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

skippedEntity

public void skippedEntity(java.lang.String pEntity)
                   throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String pTarget,
                                  java.lang.String pData)
                           throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String pPrefix)
                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String pPrefix,
                               java.lang.String pNamespaceURI)
                        throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] pChars,
                       int pStart,
                       int pLen)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator pLocator)
Description copied from class: ObservedHandlerImpl

Sets a document locator.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class ObservedHandlerImpl

setUnmarshaller

public void setUnmarshaller(UnmarshallerImpl pUnmarshaller)

getUnmarshaller

public UnmarshallerImpl getUnmarshaller()

setAddWhitespace

public void setAddWhitespace(boolean pAddWhitespace)

Sets whether trailing or prepending whitespace should be added as an unknown child. Defaults to false.


getAddWhitespace

public boolean getAddWhitespace()

Returns whether trailing or prepending whitespace should be added as an unknown child. Defaults to false.