net.sf.joost.emitter
Class DOMEmitter

java.lang.Object
  extended by net.sf.joost.emitter.StxEmitterBase
      extended by net.sf.joost.emitter.DOMEmitter
All Implemented Interfaces:
Constants, StxEmitter, ContentHandler, LexicalHandler

public class DOMEmitter
extends StxEmitterBase

This class implements the common interface StxEmitter. Is is designed for using DOMResult. So it generates a DOM-tree, which can be exported with the method getDOMTree().

Author:
Anatolij Zubow, Oliver Becker

Field Summary
private  Document document
           
private  boolean insideCDATA
           
private static org.apache.commons.logging.Log log
           
private  Node nextSiblingOfRootNodes
           
private  Stack stack
           
 
Fields inherited from interface net.sf.joost.Constants
DEBUG, DEFAULT_ENCODING, FEAT_NS, FEAT_NSPREFIX, FEATURE_URI_PREFIX, FUNC_NS, JOOST_EXT_NS, PR_ATTRIBUTES, PR_BUFFER, PR_CHILDREN, PR_CONTINUE, PR_ERROR, PR_SELF, PR_SIBLINGS, STX_NS
 
Constructor Summary
DOMEmitter(DOMResult result)
          DefaultConstructor
 
Method Summary
 void characters(char[] ch, int start, int length)
          SAX2-Callback - Creates a DOM-text-node and looks at the element at the top of the stack without removing it from the stack.
 void comment(char[] ch, int start, int length)
          SAX2-Callback
 void endCDATA()
          SAX2-Callback
 void endDocument()
          SAX2-Callback - Is empty
 void endDTD()
          SAX2-Callback - Is empty
 void endElement(String uri, String local, String raw)
          SAX2-Callback - Removes the last element at the the top of the stack.
 void endEntity(String name)
          SAX2-Callback - Is empty
 void endPrefixMapping(String prefix)
          SAX2-Callback - Is empty
 Node getDOMTree()
          After transformation you can call this method to get the document node.
 void ignorableWhitespace(char[] ch, int start, int length)
          SAX2-Callback
private  void insertNode(Node newNode)
           
 void processingInstruction(String target, String data)
          SAX2-Callback
 void setDocumentLocator(Locator locator)
          SAX2-Callback - Is empty
 void skippedEntity(String value)
          SAX2-Callback - Is empty
 void startCDATA()
          SAX2-Callback
 void startDocument()
          SAX2-Callback - Creates a Document
 void startDTD(String name, String publicId, String systemId)
          SAX2-Callback - Is empty
 void startElement(String uri, String local, String raw, Attributes attrs)
          SAX2-Callback - Creates a DOM-element-node and memorizes it for the endElement(String ,String ,String) method by putting it onto the top of this stack.
 void startEntity(String name)
          SAX2-Callback - Is empty
 void startPrefixMapping(String prefix, String uri)
          SAX2-Callback - Is empty
 
Methods inherited from class net.sf.joost.emitter.StxEmitterBase
getSystemId, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

document

private Document document

nextSiblingOfRootNodes

private Node nextSiblingOfRootNodes

stack

private Stack stack

insideCDATA

private boolean insideCDATA
Constructor Detail

DOMEmitter

public DOMEmitter(DOMResult result)
           throws ParserConfigurationException
DefaultConstructor

Throws:
ParserConfigurationException - if an error occurs while creating DocumentBuilder DOM-DocumentBuilder
Method Detail

insertNode

private void insertNode(Node newNode)

getDOMTree

public Node getDOMTree()
After transformation you can call this method to get the document node.

Returns:
A Node object

startDocument

public void startDocument()
                   throws SAXException
SAX2-Callback - Creates a Document

Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

startElement

public void startElement(String uri,
                         String local,
                         String raw,
                         Attributes attrs)
                  throws SAXException
SAX2-Callback - Creates a DOM-element-node and memorizes it for the endElement(String ,String ,String) method by putting it onto the top of this stack.

Throws:
SAXException

endElement

public void endElement(String uri,
                       String local,
                       String raw)
                throws SAXException
SAX2-Callback - Removes the last element at the the top of the stack.

Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
SAX2-Callback - Creates a DOM-text-node and looks at the element at the top of the stack without removing it from the stack.

Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
SAX2-Callback - Is empty


endPrefixMapping

public void endPrefixMapping(String prefix)
SAX2-Callback - Is empty


processingInstruction

public void processingInstruction(String target,
                                  String data)
SAX2-Callback


comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
SAX2-Callback

Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
SAX2-Callback

Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
SAX2-Callback

Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

skippedEntity

public void skippedEntity(String value)
                   throws SAXException
SAX2-Callback - Is empty

Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
SAX2-Callback

Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
SAX2-Callback - Is empty