Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Author:
  Niall Gallagher
See Also:
  `VisitorStrategy`

Method Summary
`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.

Method Detail

### read

    void read(Type type,
              NodeMap<InputNode> node)
              throws java.lang.Exception

  This is used to intercept an XML element before it is read by the underlying `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.

  Parameters:
    `type` - this is the type that represents the element
    `node` - this is the XML element to be intercepted
  Throws:
    `java.lang.Exception`

### write

    void write(Type type,
               NodeMap<OutputNode> node)
               throws java.lang.Exception

  This is used to intercept an XML element after it is written by the underlying `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.

  Parameters:
    `type` - this is the type that represents the element
    `node` - this is the XML element to be intercepted
  Throws:
    `java.lang.Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD