org.milyn.delivery.dom.serialize
Interface SerializationUnit

All Superinterfaces:
ContentHandler
All Known Implementing Classes:
ContextObjectSerializationUnit, DefaultSerializationUnit, GhostElementSerializationUnit

public interface SerializationUnit
extends ContentHandler

W3C Node Serailization interface definition.

Implementations of this interface are applied to the content during the Serialisation phase.

This interface allows element targeted (by device, profile, DTD info etc) serialization code to be implemented. It gives control over how an element is "printed" to the target device.

Serialization Units are defined in the .cdrl file (in .cdrar file(s)) in the very same way as any other content delivery resource (Assembly Units, Processing Units, DTDs etc).

Implementations must be stateless in nature.

Only one Serialisation Unit is applied to each element. If more than one Serialization Unit is applicable to a given element, the most specific Serialization Unit is choosen. See SmooksResourceConfigurationSortComparator.

See Delivery Overview.

Author:
tfennelly

Method Summary
 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, 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, 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.
 

Method Detail

writeElementStart

void writeElementStart(Element element,
                       Writer writer,
                       ExecutionContext executionContext)
                       throws IOException
Write the element start portion; the element name and it's attributes.

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

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.

writeElementEnd

void writeElementEnd(Element element,
                     Writer writer,
                     ExecutionContext executionContext)
                     throws IOException
Write the element end portion; close the element.

EG: </a>

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

void writeElementText(Text text,
                      Writer writer,
                      ExecutionContext executionContext)
                      throws IOException
Write element text.

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

void writeElementComment(Comment comment,
                         Writer writer,
                         ExecutionContext executionContext)
                         throws IOException
Write element comment.

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

void writeElementEntityRef(EntityReference entityRef,
                           Writer writer,
                           ExecutionContext executionContext)
                           throws IOException
Write element entity reference object.

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

void writeElementCDATA(CDATASection cdata,
                       Writer writer,
                       ExecutionContext executionContext)
                       throws IOException
Write element CDATA section.

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

void writeElementNode(Node node,
                      Writer writer,
                      ExecutionContext executionContext)
                      throws IOException
Write element Node object.

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

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

boolean writeChildElements()
Write the child elements of the element this SerializationUnit is being applied to.

Returns:
True if the child elements are to be writen, otherwise false.


Copyright © 2008. All Rights Reserved.