On Tue, 30 Apr 2002, Ajay Chitre wrote:

> Date: Tue, 30 Apr 2002 09:56:00 -0700
> From: Ajay Chitre <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>,
>      [EMAIL PROTECTED]
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: Re: Help required on Digester class
>
> Craig,
>
> While we are on the subject of Digester let me ask you a question about
> it...
>
> I have been using Digester for the past few months & I am loving it.  But
> one of my friends is saying that I should consider switching to JDOM.  What
> are your thoughts?
>
> My feeling is that JDOM must be more like DOM - which means I have to take
> care of parsing on my own.  Since Digester does that for me behind the scene,
> why should I worry about JDOM?  Is Digester going to use JDOM in the back?
> Or does it already?
>

Digester uses a SAX parser behind the scenes.  Personally, I find SAX much
easier to deal with when I only need one pass through the input document,
and/or the input document is too big to keep in memory all at once.  That
fits perfectly with the thing I use Digester for the most (parsing
configuration files).

For use cases when you need to navigate around the XML element tree,
and/or modify it, using DOM or JDOM might make more sense -- but, in my
personal experience, I haven't needed either very much.

It would be conceivable to have an XML document that you've already parsed
(into either DOM or JDOM), and then want to run Digester on it to extract
some interesting information.  This can be accomplished by writing your
own InputSource implementation that scans the tree and renders the
appropriate XML for Digester to read (although this has performance
implications).

> Thanks.

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to