Class GhostElementSerializerVisitor
- java.lang.Object
-
- org.smooks.engine.delivery.dom.serialize.DefaultDOMSerializerVisitor
-
- org.smooks.engine.delivery.dom.serialize.GhostElementSerializerVisitor
-
- All Implemented Interfaces:
ContentHandler
,AfterVisitor
,BeforeVisitor
,ChildrenVisitor
,ElementVisitor
,SaxNgVisitor
,SerializerVisitor
,Visitor
,DOMSerializerVisitor
public class GhostElementSerializerVisitor extends DefaultDOMSerializerVisitor implements ElementVisitor
Ghost element serialization unit. A ghost element can be used to "wrap" other DOM content. The Ghost element itself is not serialized, but it's child content is.- Author:
- tom.fennelly@gmail.com
-
-
Field Summary
-
Fields inherited from class org.smooks.engine.delivery.dom.serialize.DefaultDOMSerializerVisitor
closeEmptyElements, domSerializer, rewriteEntities
-
-
Constructor Summary
Constructors Constructor Description GhostElementSerializerVisitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Element
createElement(Document ownerDocument)
Utility method for creating a <ghost-element/> element.void
visitAfter(Element element, ExecutionContext executionContext)
Visits the end of anElement
.void
visitBefore(Element element, ExecutionContext executionContext)
Visits the beginning of anElement
.void
visitChildElement(Element childElement, ExecutionContext executionContext)
Visits a childElement
.void
visitChildText(CharacterData characterData, ExecutionContext executionContext)
Visits the character data of anElement
.void
writeEndElement(Element element, Writer writer, ExecutionContext executionContext)
Write the element end portion; close the element.void
writeStartElement(Element element, Writer writer, ExecutionContext executionContext)
Write the element start portion; the element name and it's attributes.-
Methods inherited from class org.smooks.engine.delivery.dom.serialize.DefaultDOMSerializerVisitor
postConstruct, setCloseEmptyElements, setRewriteEntities, writeCharacterData, writeChildElements, writeElementCDATA, writeElementComment, writeElementEntityRef, writeElementNode
-
-
-
-
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 interfaceSerializerVisitor
- Overrides:
writeStartElement
in classDefaultDOMSerializerVisitor
- 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
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 interfaceSerializerVisitor
- Overrides:
writeEndElement
in classDefaultDOMSerializerVisitor
- 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.
-
createElement
public static Element createElement(Document ownerDocument)
Utility method for creating a <ghost-element/> element.- Parameters:
ownerDocument
- The owner document.- Returns:
- The <ghost-element/> element.
-
visitAfter
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException
Description copied from interface:AfterVisitor
Visits the end of anElement
.- Specified by:
visitAfter
in interfaceAfterVisitor
- Parameters:
element
- theElement
representing the end of the fragment. TheElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false. TheElement
's child nodes are traversable if one of the following conditions are met:max.node.depth
global config parameter is set to 0 or greater than 1, or- this
AfterVisitor
implementsParameterizedVisitor.getMaxNodeDepth()
which returns an integer greater than 1
executionContext
- the currentExecutionContext
- Throws:
SmooksException
-
visitBefore
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException
Description copied from interface:BeforeVisitor
Visits the beginning of anElement
.- Specified by:
visitBefore
in interfaceBeforeVisitor
- Parameters:
element
- theElement
representing the beginning of the fragment. TheElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false. TheElement
's child nodes are not traversable.executionContext
- the currentExecutionContext
- Throws:
SmooksException
-
visitChildText
public void visitChildText(CharacterData characterData, ExecutionContext executionContext)
Description copied from interface:ChildrenVisitor
Visits the character data of anElement
. This method is invoked once for each chunk of character data. A shortcut for collecting character data is to annotate theSaxNgVisitor
implementation withorg.smooks.engine.delivery.sax.annotation.StreamResultWriter
, or stash the character data in aTextAccumulatorMemento
and restore theTextAccumulatorMemento
inAfterVisitor.visitAfter(Element, ExecutionContext)
.- Specified by:
visitChildText
in interfaceChildrenVisitor
- Parameters:
characterData
- thenode
which includes character data but not any childElement
s. TheElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false.executionContext
- the currentExecutionContext
-
visitChildElement
public void visitChildElement(Element childElement, ExecutionContext executionContext) throws SmooksException
Description copied from interface:ChildrenVisitor
Visits a childElement
. This method is invoked once for each childElement
.- Specified by:
visitChildElement
in interfaceChildrenVisitor
- Parameters:
childElement
- the childElementElement
's ancestors are traversable unless the global configuration parametermaintain.element.stack
is set to false. TheElement
's child nodes are not traversable.executionContext
- the currentExecutionContext
- Throws:
SmooksException
-
-