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 87534 invoked from network); 24 May 2003 01:30:38 -0000 Received: from web13507.mail.yahoo.com (216.136.175.86) by daedalus.apache.org with SMTP; 24 May 2003 01:30:38 -0000 Message-ID: <20030524013048.58134.qmail@web13507.mail.yahoo.com> Received: from [4.62.108.174] by web13507.mail.yahoo.com via HTTP; Fri, 23 May 2003 18:30:47 PDT Date: Fri, 23 May 2003 18:30:47 -0700 (PDT) From: Christopher Bare Subject: [digester] help with multi-argument constructor To: commons-user@jakarta.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, I'm trying to parse XML something like this: 1 chris As a result, I would like the following constructor to be called: public User( long id, String username ) { //... } I read in the javadocs that "FactoryCreateRule" is used to create instances of classes without a no-argument constructor, but, as far as I can tell, an ObjectCreationFactory is set up to use attributes, and not enclosed elements, for constructor parameters. Please correct me if I'm wrong here. Otherwise, is there a way to do this? Sorry if I'm missing something totally obvious, and thanks for any insight. I know... I could just add "set" methods and an empty constructor, but I hate to expose public "set" methods for the world to use and abuse where it's not really appropriate. If there's not already an obvious way to do this, and I'm just clueless, I think something like the following would be cool: digester.addCallConstructor( "users/user", User.class, 2 ); digester.addCallParam( "users/user/id", 0 ); digester.addCallParam( "users/user/name", 1 ); -Chris __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com