|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.delivery.Filter
org.milyn.delivery.dom.SmooksDOMFilter
public class SmooksDOMFilter
Smooks DOM based content filtering class.
This class is responsible for Filtering XML DOM streams (XML/XHTML/HTML etc) through a process of iterating over the source XML DOM tree and applying theconfigured Content Delivery Units
(DOMElementVisitors and
SerializationUnits).
This class doesn't get used directly. See the Smooks class.
filter(Document) or filter(Reader) 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.milyn.delivery.Filter |
|---|
Filter.StreamFilterType |
| Field Summary | |
|---|---|
static String |
DELIVERY_NODE_REQUEST_KEY
Key under which a non-document content delivery node can be set in the request. |
| Fields inherited from class org.milyn.delivery.Filter |
|---|
CLOSE_RESULT, CLOSE_SOURCE, DEFAULT_SERIALIZATION_ON, REVERSE_VISIT_ORDER_ON_VISIT_AFTER, STREAM_FILTER_TYPE, TERMINATE_ON_VISITOR_EXCEPTION |
| Constructor Summary | |
|---|---|
SmooksDOMFilter(ExecutionContext executionContext)
Public constructor. |
|
| Method Summary | |
|---|---|
void |
cleanup()
Cleanup the Filter. |
void |
doFilter(Source source,
Result result)
Filter the content in the supplied Source instance, outputing the result
to the supplied Result instance. |
Node |
filter(Document doc)
Phase the supplied W3C Document. |
Node |
filter(Reader source)
Phase the supplied input reader. |
void |
serialize(Node node,
Writer writer)
Serialise the node to the supplied output writer instance. |
| Methods inherited from class org.milyn.delivery.Filter |
|---|
close, close, getCurrentExecutionContext, getFilter, getReader, getWriter, removeCurrentExecutionContext, removeCurrentFilter, setCurrentExecutionContext, setFilter, setFilterType |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DELIVERY_NODE_REQUEST_KEY
| Constructor Detail |
|---|
public SmooksDOMFilter(ExecutionContext executionContext)
executionContext - Execution context. This instance
is bound to the current Thread of execution. See Threading Issues.| Method Detail |
|---|
public void doFilter(Source source,
Result result)
throws SmooksException
FilterSource instance, outputing the result
to the supplied Result instance.
doFilter in class Filtersource - The content Source.result - The content Result. To serialize the result, supply a StreamResult.
To have the result returned as a DOM, supply a DOMResult.
SmooksException - Failed to filter.public void cleanup()
Filter
cleanup in class Filter
public Node filter(Reader source)
throws SmooksException
filter(Document).
source - The source of markup to be filtered.
SmooksExceptionpublic Node filter(Document doc)
doc - The W3C Document to be filtered.
public 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||