tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Loading XML Files - Best Pracitices
Date Sat, 04 Jan 2003 21:36:47 GMT

On Sat, 4 Jan 2003, Jacob Kjome wrote:

> To tell you the truth, I would just use a SAX parser.  That will be faster
> than any of the other methods including JDOM.

If you've look at SAX and find it too complicated, you might want to take
a look at a couple of projects in the jakarta-commons libraries that make
dealing with XML easier.

The commons-digester package (
lets you define rules that match nesting patterns for elements, plus lots
of other neat features (like automatically propogating XML attributes into
property setter calls on your beans).  This package is what Tomcat (4.1+)
itself uses to parse server.xml and web.xml files, and it's also what
packages like Struts use to parse their own configuration files.

The commons-betwixt package is designed to make it easy to go the other
direction (beans -> XML instead of XML -> beans like Digester).  It
includes some useful techniquies that map common property naming patterns
into appropriate nesting patterns of elements and attributes.  An example
app that collaborates with digester demonstrates round tripping (XML ->
bean -> XML) quite nicely.   (

Personally, I find *all* of the low-level XML processing APIs to be, um,
er, too low level :-) for day to day use.  It's much easier to use
libraries that provide a little bit higher level abstraction when that's
possible, and save the low level stuff for when it is really the only way
to go.

> Jake

Craig McClanahan

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message