org.milyn.delivery.dom.serialize
Class Serializer

java.lang.Object
  extended by org.milyn.delivery.dom.serialize.Serializer

public class Serializer
extends Object

Node serializer.

This class uses the ContentDeliveryConfig and the SerializationUnit instances defined there on to perform the serialization.

Author:
tfennelly

Constructor Summary
Serializer(Node node, ExecutionContext executionContext)
          Public constructor.
 
Method Summary
static void recursiveDOMWrite(Element element, Writer writer)
          Recursively write the DOM tree to the supplied writer.
 void serailize(Writer writer)
          Serialise the document to the supplied output writer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Serializer

public Serializer(Node node,
                  ExecutionContext executionContext)
Public constructor.

Parameters:
node - Node to be serialized.
executionContext - Target device context.
Method Detail

serailize

public void serailize(Writer writer)
               throws ResourceConfigurationNotFoundException,
                      IOException
Serialise the document to the supplied output writer instance.

Adds the DOCTYPE decl if one defined in the Content Delivery Configuration.

If the node is a Document (or DocumentFragment) node the whole node is serialised. Otherwise, only the node child elements are serialised i.e. the node itself is skipped.

Parameters:
writer - Output writer.
Throws:
ResourceConfigurationNotFoundException - DOM Serialiser exception.
IOException - Unable to write to output writer.

recursiveDOMWrite

public static void recursiveDOMWrite(Element element,
                                     Writer writer)
                              throws IOException
Recursively write the DOM tree to the supplied writer.

Parameters:
element - Element to write.
writer - Writer to use.
Throws:
IOException - Exception writing to Writer.


Copyright © 2009. All Rights Reserved.