Save This Page
Home » cocoon-2.1.11-src » org.apache » cocoon » xml » dom » [javadoc | source]
org.apache.cocoon.xml.dom
public class: DOMStreamer [javadoc | source]
java.lang.Object
   org.apache.cocoon.xml.dom.DOMStreamer

All Implemented Interfaces:
    org.apache.avalon.excalibur.pool.Recyclable, XMLProducer

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:

Nested Class Summary:
public static class  DOMStreamer.NamespaceNormalizingDOMStreamer  Streams a DOM tree to SAX events and normalizes namespace declarations on the way.

The code in this class is based on the org.apache.xml.utils.TreeWalker class from Xalan, though it differs in some important ways.

This class will automatically fix up ("normalize") namespace declarations while streaming to SAX. The original DOM-tree is not modified. The algorithm used is described in an appendix of the DOM Level 3 spec.

This class will NOT check the correctness of namespaces, e.g. it will not check that the "xml" prefix is not misused etc. 

public static class  DOMStreamer.DefaultDOMStreamer  The DefaultDOMStreamer is a utility class that will generate SAX events from a W3C DOM Document. 
Field Summary
protected  boolean normalizeNamespaces    Indicates whether namespace normalization should happen. 
protected  DOMStreamer.NamespaceNormalizingDOMStreamer namespaceNormalizingDOMStreamer    DOMStreamer used in case of namespace normalization. 
protected  DOMStreamer.DefaultDOMStreamer defaultDOMStreamer    DOMStreamer used when namespace normalization should not explicitely happen. 
Constructor:
 public DOMStreamer() 
 public DOMStreamer(XMLConsumer consumer) 
    Create a new DOMStreamer instance.
 public DOMStreamer(ContentHandler content) 
    Create a new DOMStreamer instance.
 public DOMStreamer(ContentHandler content,
    LexicalHandler lexical) 
    Create a new DOMStreamer instance.
Method from org.apache.cocoon.xml.dom.DOMStreamer Summary:
isNormalizeNamespaces,   recycle,   setConsumer,   setContentHandler,   setLexicalHandler,   setNormalizeNamespaces,   stream
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cocoon.xml.dom.DOMStreamer Detail:
 public boolean isNormalizeNamespaces() 
 public  void recycle() 
 public  void setConsumer(XMLConsumer consumer) 
    Set the XMLConsumer that will receive XML data.
 public  void setContentHandler(ContentHandler handler) 
    Set the ContentHandler that will receive XML data.
 public  void setLexicalHandler(LexicalHandler handler) 
    Set the LexicalHandler that will receive XML data.
 public  void setNormalizeNamespaces(boolean normalizeNamespaces) 
 public  void stream(Node node) throws SAXException 
    Start the production of SAX events.