Class ContextObjectSerializerVisitor

    • Constructor Detail

      • ContextObjectSerializerVisitor

        public ContextObjectSerializerVisitor()
    • Method Detail

      • writeStartElement

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

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

        Specified by:
        writeStartElement in interface SerializerVisitor
        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.
      • getContextKey

        public static String getContextKey​(Element element)
      • writeEndElement

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

        EG: </a>

        Specified by:
        writeEndElement in interface SerializerVisitor
        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.
      • writeElementNode

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

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

        Specified by:
        writeElementNode in interface SerializerVisitor
        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: SerializerVisitor
        Write the child elements of the element this SerializationUnit is being applied to.
        Specified by:
        writeChildElements in interface SerializerVisitor
        Returns:
        True if the child elements are to be writen, otherwise false.
      • createElement

        public static Element createElement​(Document ownerDocument,
                                            String key)
        Utility method for creating a <context-object/> element.
        Parameters:
        ownerDocument - The owner document.
        key - The context key.
        Returns:
        The <context-object/> element.
      • isContextObjectElement

        public static boolean isContextObjectElement​(Element element)
      • visitAfter

        public void visitAfter​(Element element,
                               ExecutionContext executionContext)
                        throws SmooksException
        Description copied from interface: AfterVisitor
        Visits the end of an Element.
        Specified by:
        visitAfter in interface AfterVisitor
        Parameters:
        element - the Element representing the end of the fragment. The Element's ancestors are traversable unless the global configuration parameter maintain.element.stack is set to false. The Element's child nodes are traversable if one of the following conditions are met:
        executionContext - the current ExecutionContext
        Throws:
        SmooksException
      • visitBefore

        public void visitBefore​(Element element,
                                ExecutionContext executionContext)
                         throws SmooksException
        Description copied from interface: BeforeVisitor
        Visits the beginning of an Element.
        Specified by:
        visitBefore in interface BeforeVisitor
        Parameters:
        element - the Element representing the beginning of the fragment. The Element's ancestors are traversable unless the global configuration parameter maintain.element.stack is set to false. The Element's child nodes are not traversable.
        executionContext - the current ExecutionContext
        Throws:
        SmooksException
      • visitChildText

        public void visitChildText​(CharacterData characterData,
                                   ExecutionContext executionContext)
        Description copied from interface: ChildrenVisitor
        Visits the character data of an Element. This method is invoked once for each chunk of character data. A shortcut for collecting character data is to annotate the SaxNgVisitor implementation with org.smooks.engine.delivery.sax.annotation.StreamResultWriter, or stash the character data in a TextAccumulatorMemento and restore the TextAccumulatorMemento in AfterVisitor.visitAfter(Element, ExecutionContext).
        Specified by:
        visitChildText in interface ChildrenVisitor
        Parameters:
        characterData - the node which includes character data but not any child Elements. The Element's ancestors are traversable unless the global configuration parameter maintain.element.stack is set to false.
        executionContext - the current ExecutionContext
      • visitChildElement

        public void visitChildElement​(Element childElement,
                                      ExecutionContext executionContext)
                               throws SmooksException
        Description copied from interface: ChildrenVisitor
        Visits a child Element. This method is invoked once for each child Element.
        Specified by:
        visitChildElement in interface ChildrenVisitor
        Parameters:
        childElement - the child ElementElement's ancestors are traversable unless the global configuration parameter maintain.element.stack is set to false. The Element's child nodes are not traversable.
        executionContext - the current ExecutionContext
        Throws:
        SmooksException