Pattern matching with Hex
One alternative to processing XML DOM trees with recursive descent is to use pattern matching. This is available in some declarative languages such as Prolog or Miranda, but is not directly built into Java. Java however does have another very powerful facility - reflection - which can be used to add pattern matching in a simplified form. After a number of experiments, we came up with Hex.
To use Hex, you supply another class called the delegate that contains a series of actions in the form of methods named according to a special convention. Hex traverses the DOM tree in depth first order, and when it recognizes a combination of tags for which there is a matching method in the delegate, it calls the method.
The download contains full source code along with the documentation.
