commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Unknown nodes in digester?
Date Wed, 22 Jan 2003 06:33:53 GMT

On Wed, 22 Jan 2003, Bill Chmura wrote:

> Date: Wed, 22 Jan 2003 00:43:20 -0500
> From: Bill Chmura <>
> Reply-To: Jakarta Commons Users List <>
> To: 'jakarta Commons Users List' <>
> Subject: Unknown nodes in digester?
> Hello,
> I am not sure what tool to use for what I need... I've used the DOM
> before, JAXB but I hear digester is pretty good.  I've done some
> reading, but was hoping someone could give me some advice.
> I need to read a number of small XML documents.  The kicker is that
> internally I will know ahead of time what 70% of the tags are, but there
> is the possibility for unknown tags to be within a known tag.  Can
> digester be configured to handle this?

In general, Digester works on a matching principle -- it assumes you know
the element nesting pattern you are looking for.  So, whether it's useful
to you or not for your task is how far ahead of time you know what the
element names will be -- if you have some sort of information that says
"an UNKNOWN1 will be nested inside a USERDEFINED inside a ROOT", then you
can dynamically construct the matching patterns for your processing rules.

It's really impossible, though, to give you much more help without
understanding what you actually want to *do* with the data that is parsed.
For example, if you want random access to the nodes, you probably want to
use some sort of DOM-based solution -- anything that is SAX based
(including Digester) is not going to be very helpful.

> Something like:
> <ROOT>
> <UNKNOWN1></UNKNOWN1> -> ?
> <UNKNOWN2></UNKNOWN2> -> ?
> </ROOT>
> Thanks!
> Bill


View raw message