XVisitor: Visitors for JAXB

XVisitor is a plugin for the xjc code generator to enrich the JAXB model generated from an XML schema so that users can work with the Visitor pattern on this model.


  • Each model class implements a Visitable interface which has an accept(Visitor) method.
  • Passing a Visitor to accept() triggers a depth-first traversal of the corresponding subtree.
  • For each model class, there are enter() and leave() methods, which are called before and after traversing the child elements of the current node.
  • These methods have a return type of VisitorAction, an enumeration with values CONTINUE, SKIP and TERMINATE, which allow the user to skip a subtree or terminate the traversal prematurely.

Latest News

XVisitor 0.1.1 Released

XVisitor 0.1.1 is now available from Maven Central. This release fixes a bug related to SKIP actions for mixed content.

type key summary

Unable to locate Jira server for this macro. It may be due to Application Link configuration.

XVisitor 0.1.0 Released

XVisitor 0.1.0 is the first public release of the OPSJ4 XVisitor project.

XVisitor enables Java applications to use the Visitor pattern on JAXB models of XML documents. It is a plugin for the xjc code generator which enriches the JAXB model classes generated from an XML schema.

XVisitor is available from Maven Central. Check out the documentation for more details.

Introducing XVisitor

XVisitor is a new project under the OPS4J umbrella which supports the Visitor pattern for JAXB models by means of a small plugin for the xjc code generator.

There is no release yet, but you can check out the sources from the GitHub repository and give it a try. The OPS4J project infrastructure is currently being set up. Feel free to have a look at the code and post any feedback to the OPS4J mailing list.