On Fri, 4 Apr 2003, Dhulipala, Kris (SCI TW) wrote:

> Date: Fri, 4 Apr 2003 10:51:50 -0500
> From: "Dhulipala, Kris (SCI TW)" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: JAXB vs Digester
>
> Hi,
>   From what I have seen of JAXB and Digester, both fecilitate xml-> java
> class/object conversion and vice-versa. So what is the difference? When to
> use what?

A couple of very incomplete thoughts:

* Digester is one way (XML->Java), JAXB is two way (XML->Java
  and Java->XML).

* Digester is nice for pulling just a few things out of an XML
  document, JAXB typically wants you to process the whole thing.

* Digester rules can be calculated and constructed on the fly
  as you configure the Digester, and include some interesting matching
  rules that mean you don't always need to understand the entire
  document structure.  JAXB is more like DOM, giving you a tree
  structure to process.

* Digester lets you deal with dynamic sets of attributes gracefully
  (i.e. the SetPropertiesRule, for example); JAXB wants you to know
  them ahead of time.

As with most things, it's kind of hard to say that one approach is always
going to be better or worse; thinking through both approaches for each use
case is probably the best approach -- in particular, I'd implement a
couple of simple use cases both ways to see which one appeals to you more.

> Thanks,
> Kris

Craig

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

Reply via email to