Interface SerializerVisitor

  • All Superinterfaces:
    ContentHandler, Visitor

    public interface SerializerVisitor
    extends Visitor
    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 ResourceConfigSortComparator.

    See Delivery Overview.

    Author:
    tfennelly
    • Method Detail

      • writeStartElement

        void writeStartElement​(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.
      • writeEndElement

        void writeEndElement​(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.
      • writeCharacterData

        void writeCharacterData​(Node node,
                                Writer writer,
                                ExecutionContext executionContext)
                         throws IOException
        Write element text.
        Parameters:
        node - 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.