org.apache.ws.commons.serialize
Class DOMSerializer

java.lang.Object
  extended by org.apache.ws.commons.serialize.DOMSerializer

public class DOMSerializer
extends java.lang.Object

Serializes a DOM node into a stream of SAX events.


Constructor Summary
DOMSerializer()
           
 
Method Summary
protected  void doSerialize(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler)
          Converts the given node pNode into a stream of SAX events, which are fired into the content handler pHandler.
protected  void doSerializeChilds(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler)
          Serializes the childs of pNode.
 boolean isNamespaceDeclarationAttribute()
          Returns whether XML declarations are being serialized as attributes or as SAX events (default).
 boolean isParentsNamespaceDeclarationDisabled()
          Sets whether XML declarations present in the parent nodes are being serialized (default) or not.
 boolean isStartingDocument()
          Returns, whether startDocument and endDocument events are generated for document nodes.
 void serialize(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler)
          Converts the given node pNode into a stream of SAX events, which are fired into the content handler pHandler.
 void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute)
          Sets whether XML namespace declarations are being serialized as attributes or as SAX events (default).
 void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled)
          Returns whether XML declarations present in the parent nodes are being serialized (default) or not.
 void setStartingDocument(boolean pStartingDocument)
          Sets, whether startDocument and endDocument events are generated for document nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMSerializer

public DOMSerializer()
Method Detail

setNamespaceDeclarationAttribute

public void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute)
Sets whether XML namespace declarations are being serialized as attributes or as SAX events (default).

Parameters:
pXmlDeclarationAttribute - True, if a namespace declaration is being transmitted as an XML attribute. False otherwise.

isNamespaceDeclarationAttribute

public boolean isNamespaceDeclarationAttribute()
Returns whether XML declarations are being serialized as attributes or as SAX events (default).

Returns:
True, if a namespace declaration is being transmitted as an XML attribute. False otherwise.

setParentsNamespaceDeclarationDisabled

public void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled)
Returns whether XML declarations present in the parent nodes are being serialized (default) or not. This option takes effect only if the namespace declarations are sent as events. In other words, if the namespaceDeclarationAttribute properts is false.

Parameters:
pParentsXmlDeclarationDisabled - True, if namespace declarations of the parent nodes are disabled, false otherwise.

isParentsNamespaceDeclarationDisabled

public boolean isParentsNamespaceDeclarationDisabled()
Sets whether XML declarations present in the parent nodes are being serialized (default) or not. This option takes effect only if the namespace declarations are sent as events. In other words, if the namespaceDeclarationAttribute properts is false.

Returns:
True, if namespace declarations of the parent nodes are disabled, false otherwise.

isStartingDocument

public boolean isStartingDocument()
Returns, whether startDocument and endDocument events are generated for document nodes.

Returns:
True (default), if startDocument and endDocument events are being generated. False otherwise.

setStartingDocument

public void setStartingDocument(boolean pStartingDocument)
Sets, whether startDocument and endDocument events are generated for document nodes.

Parameters:
pStartingDocument - True (default), if startDocument and endDocument events are being generated. False otherwise.

doSerializeChilds

protected void doSerializeChilds(org.w3c.dom.Node pNode,
                                 org.xml.sax.ContentHandler pHandler)
                          throws org.xml.sax.SAXException
Serializes the childs of pNode.

Parameters:
pNode - The parent node, whose childs are being serialized.
pHandler - The target handler.
Throws:
org.xml.sax.SAXException - The target handler reported an error.

serialize

public void serialize(org.w3c.dom.Node pNode,
                      org.xml.sax.ContentHandler pHandler)
               throws org.xml.sax.SAXException
Converts the given node pNode into a stream of SAX events, which are fired into the content handler pHandler.

Parameters:
pNode - The node being serialized.
pHandler - The target handler.
Throws:
org.xml.sax.SAXException - The target handler reported an error.

doSerialize

protected void doSerialize(org.w3c.dom.Node pNode,
                           org.xml.sax.ContentHandler pHandler)
                    throws org.xml.sax.SAXException
Converts the given node pNode into a stream of SAX events, which are fired into the content handler pHandler. Unlike serialize(Node, ContentHandler), this method doesn't call parentsStartPrefixMappingEvents(Node, ContentHandler), and parentsEndPrefixMappingEvents(Node, ContentHandler).

Parameters:
pNode - The node being serialized.
pHandler - The target handler.
Throws:
org.xml.sax.SAXException - The target handler reported an error.


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.