org.apache.cocoon.xml.dom
Class DOMStreamer

java.lang.Object
  extended by org.apache.cocoon.xml.dom.DOMStreamer
All Implemented Interfaces:
Poolable, Recyclable, XMLProducer

public class DOMStreamer
extends Object
implements XMLProducer, Recyclable

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

The DOMStreamer uses a different strategy based on the value of the normalizeNamespaces property:

Version:
$Id: DOMStreamer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler, Pierpaolo Fumagalli (Apache Software Foundation)

Nested Class Summary
static class DOMStreamer.DefaultDOMStreamer
          The DefaultDOMStreamer is a utility class that will generate SAX events from a W3C DOM Document.
static class DOMStreamer.NamespaceNormalizingDOMStreamer
          Streams a DOM tree to SAX events and normalizes namespace declarations on the way.
 
Field Summary
protected  DOMStreamer.DefaultDOMStreamer defaultDOMStreamer
          DOMStreamer used when namespace normalization should not explicitely happen.
protected  DOMStreamer.NamespaceNormalizingDOMStreamer namespaceNormalizingDOMStreamer
          DOMStreamer used in case of namespace normalization.
protected  boolean normalizeNamespaces
          Indicates whether namespace normalization should happen.
 
Constructor Summary
DOMStreamer()
          Create a new DOMStreamer instance.
DOMStreamer(ContentHandler content)
          Create a new DOMStreamer instance.
DOMStreamer(ContentHandler content, LexicalHandler lexical)
          Create a new DOMStreamer instance.
DOMStreamer(XMLConsumer consumer)
          Create a new DOMStreamer instance.
 
Method Summary
 boolean isNormalizeNamespaces()
           
 void recycle()
           
 void setConsumer(XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setContentHandler(ContentHandler handler)
          Set the ContentHandler that will receive XML data.
 void setLexicalHandler(LexicalHandler handler)
          Set the LexicalHandler that will receive XML data.
 void setNormalizeNamespaces(boolean normalizeNamespaces)
           
 void stream(Node node)
          Start the production of SAX events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normalizeNamespaces

protected boolean normalizeNamespaces
Indicates whether namespace normalization should happen.


namespaceNormalizingDOMStreamer

protected DOMStreamer.NamespaceNormalizingDOMStreamer namespaceNormalizingDOMStreamer
DOMStreamer used in case of namespace normalization.


defaultDOMStreamer

protected DOMStreamer.DefaultDOMStreamer defaultDOMStreamer
DOMStreamer used when namespace normalization should not explicitely happen.

Constructor Detail

DOMStreamer

public DOMStreamer()
Create a new DOMStreamer instance.


DOMStreamer

public DOMStreamer(ContentHandler content,
                   LexicalHandler lexical)
Create a new DOMStreamer instance.


DOMStreamer

public DOMStreamer(XMLConsumer consumer)
Create a new DOMStreamer instance.


DOMStreamer

public DOMStreamer(ContentHandler content)
Create a new DOMStreamer instance.

Method Detail

setConsumer

public void setConsumer(XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.

Specified by:
setConsumer in interface XMLProducer

setContentHandler

public void setContentHandler(ContentHandler handler)
Set the ContentHandler that will receive XML data.


setLexicalHandler

public void setLexicalHandler(LexicalHandler handler)
Set the LexicalHandler that will receive XML data.


stream

public void stream(Node node)
            throws SAXException
Start the production of SAX events.

Throws:
SAXException

isNormalizeNamespaces

public boolean isNormalizeNamespaces()

setNormalizeNamespaces

public void setNormalizeNamespaces(boolean normalizeNamespaces)

recycle

public void recycle()
Specified by:
recycle in interface Recyclable


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