Jakarta Commons - Digester component
The Digester component of the Jakarta Commons project is an extremely useful and well-designed package that allows you to parse XML files at a higher level of abstraction in Java. This allows developers to concentrate on processing XML rather than get unnecessarily involved in parsing functions. With Digester, you can use simple matching patterns and write corresponding callback functions which are called whenever a match is found. For example, consider the XML snippet below.
<book> <title>The Hobbit</title> <author>J. R. R. Tolkien</author> </book>
In Digester, you can write this (in Java):
Digester digester = new Digester();
digester.addObjectCreate("book", "Book");
digester.addCallMethod("book/title","setTitle",0);
digester.addCallMethod("book/authors","setAuthor", 0);
digester.parse("books.xml");
When Digester parses the XML file (assumed to be "books.xml"), it will create a Book object when it encounters the