public class SmooksDOMFilter extends Filter
configured Content Delivery Units
(DOMElementVisitors and
SerializationUnits).
This class doesn't get used directly. See the Smooks class.
filter(Document) or filter(Source) methods.
This phase is really 2 "sub" phases.
ASSEMBLY phase
DOMElementVisitors
targeted at them for the profile
associated with the ExecutionContext.
This phase can result in DOM elements being added to, or trimmed from, the DOM.
This phase is also very usefull for gathering data from the message in the DOM
(and storing it in the ExecutionContext),
which can be used during the processing phase (see below). This phase is only
executed if there are
DOMElementVisitors targeted at this phase.
PROCESSING phase
DOMElementVisitors
targeted at them for the profile
associated with the ExecutionContext.
This phase will only operate on DOM elements that were present in the assembled
document; DOMElementVisitors will not be applied
to elements that are introduced to the DOM during this phase.
serialize(Node, Writer) method (which uses the
Serializer class). The serialisation phase takes the processed DOM and
iterates over it to apply all SerializationUnits,
which write the document to the target output stream.
Instead of using this serialisation mechanism, you may wish to perform
DOM Serialisation via some other mechanism e.g. XSL-FO via something like Apache FOP.
Filter.StreamFilterType| Modifier and Type | Field and Description |
|---|---|
static String |
DELIVERY_NODE_REQUEST_KEY
Key under which a non-document content delivery node can be set in the
request.
|
CLOSE_RESULT, CLOSE_SOURCE, DEFAULT_SERIALIZATION_ON, ENTITIES_REWRITE, MAINTAIN_ELEMENT_STACK, READER_POOL_SIZE, REVERSE_VISIT_ORDER_ON_VISIT_AFTER, STREAM_FILTER_TYPE, TERMINATE_ON_VISITOR_EXCEPTION| Constructor and Description |
|---|
SmooksDOMFilter(ExecutionContext executionContext)
Public constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Cleanup the Filter.
|
void |
doFilter()
|
protected void |
doFilter(Source source,
Result result) |
Node |
filter(Document doc) |
Node |
filter(Element element) |
Node |
filter(Source source) |
void |
serialize(Node node,
Writer writer)
Serialise the node to the supplied output writer instance.
|
close, close, getCurrentExecutionContext, getFilter, getReader, getWriter, removeCurrentExecutionContext, removeCurrentFilter, setCurrentExecutionContext, setFilter, setFilterType, setFilterTypepublic static final String DELIVERY_NODE_REQUEST_KEY
public SmooksDOMFilter(ExecutionContext executionContext)
executionContext - Execution context. This instance
is bound to the current Thread of execution. See Threading Issues.public void doFilter()
throws SmooksException
FilterSource instance, outputing the result
to the supplied Result instance.
Implementations use static methods on the FilterSource and FilterResult classes
to access the Source and Results objects.doFilter in class FilterSmooksException - Failed to filter.public void cleanup()
Filterpublic Node filter(Source source) throws SmooksException
SmooksExceptionpublic void serialize(Node node, Writer writer) throws IOException, SmooksException
Serializer class to perform the serialization.node - Document to be serialised.writer - Output writer.ResourceConfigurationNotFoundException - DOM Serialiser exception.IOException - Unable to write to output writer.SmooksException - Unable to serialise due to bad Smooks environment. Check cause.Copyright © 2015. All rights reserved.