public interface Visitor
Visitor
interface represents an object that is
used to visit each XML element during serialization. For the
deserialization process each XML element is visited before
control is returned to the serializer. This allows a visitor
implementation to perform some operation based on the node
that is being deserialized. Typically a visitor is used to
edit the node, for example it may remove or insert attributes.
In effect this can act much like a transformer that sits
between a Strategy
implementation and the core
serializer. It enables interception and manipulation of the
node so that the resulting XML document can be customized in
a way that can not be performed by the underlying strategy.
VisitorStrategy
Modifier and Type | Method and Description |
---|---|
void |
read(Type type,
NodeMap<InputNode> node)
This is used to intercept an XML element before it is read
by the underlying
Strategy implementation. |
void |
write(Type type,
NodeMap<OutputNode> node)
This is used to intercept an XML element after it is written
by the underlying
Strategy implementation. |
void read(Type type, NodeMap<InputNode> node) throws Exception
Strategy
implementation. When
a node is intercepted it can be manipulated in such a way
that its semantics change. For example, this could be used
to change the way a "class" attribute is represented, which
would allow the XML to appear in a language neutral format.type
- this is the type that represents the elementnode
- this is the XML element to be interceptedException
void write(Type type, NodeMap<OutputNode> node) throws Exception
Strategy
implementation. When
a node is intercepted it can be manipulated in such a way
that its semantics change. For example, this could be used
to change the way a "class" attribute is represented, which
would allow the XML to appear in a language neutral format.type
- this is the type that represents the elementnode
- this is the XML element to be interceptedException