public class ContextObjectSerializationUnit extends Object implements SerializationUnit, SAXElementVisitor
ExecutionContext
object serializer.
Outputs an object bound to the ExecutionContext
. The location of the object (context key)
must be specified on the "key" attribute.Constructor and Description |
---|
ContextObjectSerializationUnit() |
Modifier and Type | Method and Description |
---|---|
static Element |
createElement(Document ownerDocument,
String key)
Utility method for creating a <context-object/> element.
|
static String |
getContextKey(Element element) |
static boolean |
isContextObjectElement(Element element) |
void |
onChildElement(SAXElement element,
SAXElement childElement,
ExecutionContext executionContext)
Process the onChildElement event for the targeted element.
|
void |
onChildText(SAXElement element,
SAXText text,
ExecutionContext executionContext)
Process the onChildText event for the targeted element.
|
void |
visitAfter(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element after visiting its child elements.
|
void |
visitBefore(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element before visiting its child elements.
|
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 |
writeElementEnd(Element element,
Writer writer,
ExecutionContext executionContext)
Write the element end portion; close the element.
|
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 |
writeElementStart(Element element,
Writer writer,
ExecutionContext executionContext)
Write the element start portion; the element name and it's
attributes.
|
void |
writeElementText(Text text,
Writer writer,
ExecutionContext executionContext)
Write element text.
|
public void writeElementStart(Element element, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementStart
in interface SerializationUnit
element
- The element start to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementEnd(Element element, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementEnd
in interface SerializationUnit
element
- The element end to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementText(Text text, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementText
in interface SerializationUnit
text
- The Text object to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementComment(Comment comment, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementComment
in interface SerializationUnit
comment
- The comment o write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementEntityRef(EntityReference entityRef, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementEntityRef
in interface SerializationUnit
entityRef
- The entity reference to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementCDATA(CDATASection cdata, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementCDATA
in interface SerializationUnit
cdata
- The CDATA section to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public void writeElementNode(Node node, Writer writer, ExecutionContext executionContext) throws IOException
SerializationUnit
writeElementNode
in interface SerializationUnit
node
- The node to write.writer
- The writer to be written to.executionContext
- ExecutionContext instance for the delivery context.IOException
- Exception writing output.public boolean writeChildElements()
SerializationUnit
writeChildElements
in interface SerializationUnit
public static Element createElement(Document ownerDocument, String key)
ownerDocument
- The owner document.key
- The context key.public static boolean isContextObjectElement(Element element)
public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitBefore
visitBefore
in interface SAXVisitBefore
element
- The SAX element being visited.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void onChildText(SAXElement element, SAXText text, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitChildren
onChildText
in interface SAXVisitChildren
element
- The element containing the text (parent). The targeted element.text
- The text.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void onChildElement(SAXElement element, SAXElement childElement, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitChildren
onChildElement
in interface SAXVisitChildren
element
- The element containing the child element (parent). The targeted element.childElement
- The child element just added to the targeted element.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitAfter
visitAfter
in interface SAXVisitAfter
element
- The SAX element being visited.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.Copyright © 2020. All rights reserved.