To use Commons Digester in a Maven 2 project, add the following
dependency to your project's pom.xml
:
Example 6.1. Adding a Dependency on Commons Digester
<dependency> <groupId>commons-digester</groupId> <artifactId>commons-digester</artifactId> <version>1.8</version> </dependency>
If you are not sure what this means, I'd suggest reading Maven: The Definitive
Guide. When you depend on a library in Maven 2, all you need to
do is add the dependency groupId
,
artifactId
, and version
to your
project's dependencies. Once you do this, Maven 2 will download the
dependency and make it available on your project's classpath.
Commons Digester started as a part of Struts, and it was moved to
the Commons project by way of the Commons Sandbox in early 2001.
Digester is the mechanism Struts uses to read XML configuration;
struts-config.xml
is the main
configuration point for Struts, and it is converted to a set of objects
using the Digester. The Digester's most straightforward application is
the mapping of an XML document to a set of Java objects, but, as shown
in this chapter and Chapter
12, Digester can also be used to create a simple XML command
language and search index. Digester is a shortcut for creating a SAX
parser. Almost anything you can do with a SAX parser can be done with
Commons Digester.
For more information about Commons Digester, see the Commons Digester project page at http://commons.apache.org/digester. For information about using the Digester to create a Lucene index, see Chapter 12.