Package org.simpleframework.xml.strategy
Interface Visitor
public interface Visitor
The
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This is used to intercept an XML element before it is read by the underlyingStrategy
implementation.void
write
(Type type, NodeMap<OutputNode> node) This is used to intercept an XML element after it is written by the underlyingStrategy
implementation.
-
Method Details
-
read
This is used to intercept an XML element before it is read by the underlyingStrategy
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.- Parameters:
type
- this is the type that represents the elementnode
- this is the XML element to be intercepted- Throws:
Exception
-
write
This is used to intercept an XML element after it is written by the underlyingStrategy
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.- Parameters:
type
- this is the type that represents the elementnode
- this is the XML element to be intercepted- Throws:
Exception
-