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 BooleancloseEmptyElementsprotected DomSerializerdomSerializerprotected BooleanrewriteEntities
-
Constructor Summary
Constructors Constructor Description DefaultDOMSerializerVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpostConstruct()voidsetCloseEmptyElements(Optional<Boolean> closeEmptyElements)voidsetRewriteEntities(Optional<Boolean> rewriteEntities)voidwriteCharacterData(Node node, Writer writer, ExecutionContext executionContext)Write element text.booleanwriteChildElements()Write the child elements of the element this SerializationUnit is being applied to.voidwriteElementCDATA(CDATASection cdata, Writer writer, ExecutionContext executionContext)Write element CDATA section.voidwriteElementComment(Comment comment, Writer writer, ExecutionContext executionContext)Write element comment.voidwriteElementEntityRef(EntityReference entityRef, Writer writer, ExecutionContext executionContext)Write element entity reference object.voidwriteElementNode(Node node, Writer writer, ExecutionContext executionContext)Write element Node object.voidwriteEndElement(Element element, Writer writer, ExecutionContext executionContext)Write the element end portion; close the element.voidwriteStartElement(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:SerializerVisitorWrite the element start portion; the element name and it's attributes. EG: <a href="http://www.x.com">- Specified by:
writeStartElementin 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:SerializerVisitorWrite the element end portion; close the element. EG: </a>- Specified by:
writeEndElementin 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:SerializerVisitorWrite element text.- Specified by:
writeCharacterDatain 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:SerializerVisitorWrite element comment.- Specified by:
writeElementCommentin 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:SerializerVisitorWrite element entity reference object.- Specified by:
writeElementEntityRefin 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:SerializerVisitorWrite element CDATA section.- Specified by:
writeElementCDATAin 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:SerializerVisitorWrite element Node object. Called to write DOM types not covered by the other methods on this interface.- Specified by:
writeElementNodein 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:SerializerVisitorWrite the child elements of the element this SerializationUnit is being applied to.- Specified by:
writeChildElementsin interfaceSerializerVisitor- Returns:
- True if the child elements are to be writen, otherwise false.
-
-