org.apache.cocoon.xml.dom
Class DOMBuilder

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.xml.dom.DOMBuilder
All Implemented Interfaces:
ContentHandler, LexicalHandler, Poolable, Recyclable, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class DOMBuilder
extends AbstractXMLPipe

The DOMBuilder is a utility class that will generate a W3C DOM Document from SAX events.

Version:
$Id: DOMBuilder.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
static interface DOMBuilder.Listener
          The Listener interface must be implemented by those objects willing to be notified of a successful DOM tree generation.
 
Field Summary
protected  SAXTransformerFactory factory
          The transformer factory
protected static SAXTransformerFactory FACTORY
          The default transformer factory shared by all instances
protected  DOMBuilder.Listener listener
          The listener
protected  Node parentNode
          The parentNode
protected  DOMResult result
          The result
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Constructor Summary
DOMBuilder()
          Construct a new instance of this DOMBuilder.
DOMBuilder(DOMBuilder.Listener listener)
          Construct a new instance of this DOMBuilder.
DOMBuilder(DOMBuilder.Listener listener, Node parentNode)
          Construct a new instance of this DOMBuilder.
DOMBuilder(Node parentNode)
          Constructs a new instance that appends nodes to the given parent node.
DOMBuilder(SAXTransformerFactory factory)
          Construct a new instance of this DOMBuilder.
DOMBuilder(SAXTransformerFactory factory, DOMBuilder.Listener listener, Node parentNode)
          Construct a new instance of this DOMBuilder.
 
Method Summary
 void endDocument()
          Receive notification of the end of a document.
 Document getDocument()
          Return the newly built Document.
protected  void notifyListener()
          Receive notification of a successfully completed DOM tree generation.
 void recycle()
          Recycle this builder, prepare for re-use.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

FACTORY

protected static final SAXTransformerFactory FACTORY
The default transformer factory shared by all instances


factory

protected SAXTransformerFactory factory
The transformer factory


listener

protected DOMBuilder.Listener listener
The listener


result

protected DOMResult result
The result


parentNode

protected Node parentNode
The parentNode

Constructor Detail

DOMBuilder

public DOMBuilder()
Construct a new instance of this DOMBuilder.


DOMBuilder

public DOMBuilder(SAXTransformerFactory factory)
Construct a new instance of this DOMBuilder.


DOMBuilder

public DOMBuilder(DOMBuilder.Listener listener)
Construct a new instance of this DOMBuilder.


DOMBuilder

public DOMBuilder(Node parentNode)
Constructs a new instance that appends nodes to the given parent node.
Note: You cannot use a Listener when appending to a Node, because the notification occurs at endDocument() which does not happen here.


DOMBuilder

public DOMBuilder(DOMBuilder.Listener listener,
                  Node parentNode)
Construct a new instance of this DOMBuilder.


DOMBuilder

public DOMBuilder(SAXTransformerFactory factory,
                  DOMBuilder.Listener listener,
                  Node parentNode)
Construct a new instance of this DOMBuilder.

Method Detail

recycle

public void recycle()
Recycle this builder, prepare for re-use.

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractXMLProducer

getDocument

public Document getDocument()
Return the newly built Document.


endDocument

public void endDocument()
                 throws SAXException
Receive notification of the end of a document.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class AbstractXMLPipe
Throws:
SAXException - If this method was not called appropriately.

notifyListener

protected void notifyListener()
                       throws SAXException
Receive notification of a successfully completed DOM tree generation.

Throws:
SAXException


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.