commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [digester] Digester vs xmlbean vs JAXB
Date Wed, 12 Nov 2003 02:26:04 GMT
Quoting Samuel Cheung <SCheung@Novarra.com>:

> 
> I have a newbie question. What are the advantages/dis-advantages between
> Digester vs xmlbean vs JAXB? My understanding is they convert XML file to
> Java Class. Is that correct?
> 
> If that is the case, shouldn't one use JAXB over xmlbean and Digester, since
> JAXB is "standard"? 
> 
> Thanks for any feedback.
> 


Digester isn't in quite the same space as either XmlBeans or JAXB, although
there are some overlaps.  It was originally intended as a way to read
configuration files in XML (it's used that way in both Tomcat and Struts), but
it has proven to be an easy way to pull just the relevant bits of data out of
an XML document, without having to understand the nuances of SAX-based XML
parsing (which is what it does under the covers).

Areas of difference include:

* Digester doesn't try to synthesize bean classes for
  you by looking at a DTD or schema; it assumes you've
  done that already.

* On the other hand, Digester doesn't care what implementation
  classes you are using for the beans, as long as the classes
  obey JavaBeans design principles.  For example, the "set properties"
  rule will match up the attributes set on a particular XML element
  to corresponding JavaBeans properties, and call the setters (even
  doing type conversions for you), without having to know what
  the underlying class is.

* Digester is primarily about firing rules when a particular
  pattern of nested elements occurs.  Quite often, this is used
  to create object trees and populate JavaBeans properties
  (courtesy of several easy to use standard Rule implementations),
  but you're certainly not limited to this.

* Digester is one-way (XML --> tree of Java objects), although
  you can use the companion Betwixt project to go the other way.

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message