Class DefaultDOMSerializerVisitor
- java.lang.Object
-
- org.smooks.engine.delivery.dom.serialize.DefaultDOMSerializerVisitor
-
- All Implemented Interfaces:
ContentHandler
,SerializerVisitor
,Visitor
,DOMSerializerVisitor
- Direct Known Subclasses:
GhostElementSerializerVisitor
,TextSerializerVisitor
public class DefaultDOMSerializerVisitor extends Object implements DOMSerializerVisitor
-
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
closeEmptyElements
protected DomSerializer
domSerializer
protected Boolean
rewriteEntities
-
Constructor Summary
Constructors Constructor Description DefaultDOMSerializerVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
postConstruct()
void
setCloseEmptyElements(Optional<Boolean> closeEmptyElements)
void
setRewriteEntities(Optional<Boolean> rewriteEntities)
void
writeCharacterData(Node node, Writer writer, ExecutionContext executionContext)
Write element text.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
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
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.
-
-
-
Field Detail
-
domSerializer
protected DomSerializer domSerializer
-
closeEmptyElements
protected Boolean closeEmptyElements
-
rewriteEntities
protected Boolean rewriteEntities
-
-
Method Detail
-
setCloseEmptyElements
@Inject public void setCloseEmptyElements(@Named("close.empty.elements") Optional<Boolean> closeEmptyElements)
-
setRewriteEntities
@Inject public void setRewriteEntities(@Named("entities.rewrite") Optional<Boolean> rewriteEntities)
-
postConstruct
@PostConstruct public void postConstruct()
-
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
- 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
- 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
public void writeCharacterData(Node node, Writer writer, ExecutionContext executionContext) throws IOException
Description copied from interface:SerializerVisitor
Write element text.- Specified by:
writeCharacterData
in interfaceSerializerVisitor
- 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
public void writeElementComment(Comment comment, Writer writer, ExecutionContext executionContext) throws IOException
Description copied from interface:SerializerVisitor
Write element comment.- Specified by:
writeElementComment
in interfaceSerializerVisitor
- 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
public void writeElementEntityRef(EntityReference entityRef, Writer writer, ExecutionContext executionContext) throws IOException
Description copied from interface:SerializerVisitor
Write element entity reference object.- Specified by:
writeElementEntityRef
in interfaceSerializerVisitor
- 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
public void writeElementCDATA(CDATASection cdata, Writer writer, ExecutionContext executionContext) throws IOException
Description copied from interface:SerializerVisitor
Write element CDATA section.- Specified by:
writeElementCDATA
in interfaceSerializerVisitor
- 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
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 interfaceSerializerVisitor
- 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 interfaceSerializerVisitor
- Returns:
- True if the child elements are to be writen, otherwise false.
-
-