org.milyn.delivery.dom.serialize
Class DefaultSerializationUnit

java.lang.Object
  extended by org.milyn.delivery.dom.serialize.DefaultSerializationUnit
All Implemented Interfaces:
ContentHandler, SerializationUnit
Direct Known Subclasses:
GhostElementSerializationUnit

public class DefaultSerializationUnit
extends Object
implements SerializationUnit

Default SerializationUnit implementation.

Default SerialisationUnit where none defined.

Author:
tfennelly

Constructor Summary
DefaultSerializationUnit()
           
 
Method Summary
 void setCloseEmptyElements(boolean closeEmptyElements)
           
protected  void writeAttributes(NamedNodeMap attributes, Writer writer)
          Write the element attributes.
 boolean writeChildElements()
          Write the child elements of the element this SerializationUnit is being applied to.
 void writeElementCDATA(CDATASection cdata, Writer writer, ExecutionContext executionContext)
          Write element CDATA section.
 void writeElementComment(Comment comment, Writer writer, ExecutionContext executionContext)
          Write element comment.
 void writeElementEnd(Element element, Writer writer)
           
 void writeElementEnd(Element element, Writer writer, ExecutionContext executionContext)
          Write the element end portion; close the element.
 void writeElementEntityRef(EntityReference entityRef, Writer writer, ExecutionContext executionContext)
          Write element entity reference object.
 void writeElementNode(Node node, Writer writer, ExecutionContext executionContext)
          Write element Node object.
 void writeElementStart(Element element, Writer writer)
           
 void writeElementStart(Element element, Writer writer, ExecutionContext executionContext)
          Write the element start portion; the element name and it's attributes.
 void writeElementText(Text text, Writer writer, ExecutionContext executionContext)
          Write element text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSerializationUnit

public DefaultSerializationUnit()
Method Detail

setCloseEmptyElements

public void setCloseEmptyElements(boolean closeEmptyElements)

writeElementStart

public void writeElementStart(Element element,
                              Writer writer,
                              ExecutionContext executionContext)
                       throws IOException
Description copied from interface: SerializationUnit
Write the element start portion; the element name and it's attributes.

EG: <a href="http://www.x.com">

Specified by:
writeElementStart in interface SerializationUnit
Parameters:
element - The element start to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementStart

public void writeElementStart(Element element,
                              Writer writer)
                       throws IOException
Throws:
IOException

writeAttributes

protected void writeAttributes(NamedNodeMap attributes,
                               Writer writer)
                        throws IOException
Write the element attributes.

Parameters:
attributes - The element attibutes.
writer - The writer to be written to.
Throws:
IOException - Exception writing output.

writeElementEnd

public void writeElementEnd(Element element,
                            Writer writer)
                     throws IOException
Throws:
IOException

writeElementEnd

public void writeElementEnd(Element element,
                            Writer writer,
                            ExecutionContext executionContext)
                     throws IOException
Description copied from interface: SerializationUnit
Write the element end portion; close the element.

EG: </a>

Specified by:
writeElementEnd in interface SerializationUnit
Parameters:
element - The element end to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementText

public void writeElementText(Text text,
                             Writer writer,
                             ExecutionContext executionContext)
                      throws IOException
Description copied from interface: SerializationUnit
Write element text.

Specified by:
writeElementText in interface SerializationUnit
Parameters:
text - The Text object to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementComment

public void writeElementComment(Comment comment,
                                Writer writer,
                                ExecutionContext executionContext)
                         throws IOException
Description copied from interface: SerializationUnit
Write element comment.

Specified by:
writeElementComment in interface SerializationUnit
Parameters:
comment - The comment o write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementEntityRef

public void writeElementEntityRef(EntityReference entityRef,
                                  Writer writer,
                                  ExecutionContext executionContext)
                           throws IOException
Description copied from interface: SerializationUnit
Write element entity reference object.

Specified by:
writeElementEntityRef in interface SerializationUnit
Parameters:
entityRef - The entity reference to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementCDATA

public void writeElementCDATA(CDATASection cdata,
                              Writer writer,
                              ExecutionContext executionContext)
                       throws IOException
Description copied from interface: SerializationUnit
Write element CDATA section.

Specified by:
writeElementCDATA in interface SerializationUnit
Parameters:
cdata - The CDATA section to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeElementNode

public void writeElementNode(Node node,
                             Writer writer,
                             ExecutionContext executionContext)
                      throws IOException
Description copied from interface: SerializationUnit
Write element Node object.

Called to write DOM types not covered by the other methods on this interface.

Specified by:
writeElementNode in interface SerializationUnit
Parameters:
node - The node to write.
writer - The writer to be written to.
executionContext - ExecutionContext instance for the delivery context.
Throws:
IOException - Exception writing output.

writeChildElements

public boolean writeChildElements()
Description copied from interface: SerializationUnit
Write the child elements of the element this SerializationUnit is being applied to.

Specified by:
writeChildElements in interface SerializationUnit
Returns:
True if the child elements are to be writen, otherwise false.


Copyright © 2008. All Rights Reserved.