Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 87870 invoked from network); 28 Apr 2003 16:17:56 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 28 Apr 2003 16:17:56 -0000 Received: (qmail 71778 invoked by uid 1059); 28 Apr 2003 16:17:54 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 28 Apr 2003 16:17:54 -0000 Date: Mon, 28 Apr 2003 09:17:53 -0700 (PDT) From: "Craig R. McClanahan" To: Jakarta Commons Users List Subject: Re: [Digester] Newbie question In-Reply-To: Message-ID: <20030428091143.G61706@icarus.apache.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Mon, 28 Apr 2003, Frank Meijer wrote: > Date: Mon, 28 Apr 2003 11:20:39 -0400 > From: Frank Meijer > Reply-To: Jakarta Commons Users List > To: Jakarta Commons Users List > Subject: [Digester] Newbie question > > How is Digester different from JAXB? What would cause me to choose one over > the other? > Digester preceeded JAXB by a couple of years, and is somewhat narrower+different in scope. * Digester focuses only on reading XML (and a common use case is creating corresponding beans, but that's not the only one), while JAXB offers bidirectional support (java->XML as well). * Digester does not presuppose that you're going to process the entire XML document -- you define matching rules to pull out what you are interested in, and ignore the rest. JAXB wants a bean hierarchy to match the entire document. * Digester can be used to pull data out of any well-formed XML document, at the cost of having to create your own bean classes; JAXB has limits but will auto-generate bean classes for your. * Digester leverages the underlying BeanUtils capabilities to set bean properties via reflection. As a result, for example, it supports open-ended sets of attributes that can all be set into the corresponding bean properties with SetPropertiesRule. Digester was originally created for processing configuration files like server.xml in Tomcat, and struts-config.xml in Struts. It's features and functionality are biased towards what you need for that use case. (Note that a companion Commons package, betwixt, does some of the Java->XML stuff you might want). JAXB was originally created as a data binding solution that can map between XML and Java objects in a general way, and (most especially) in a bidirectional way. Which one to use depends, of course, on your app requirements. > Thanks, > ...Frank > Craig