Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 39702 invoked from network); 29 Jun 2007 10:54:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Jun 2007 10:54:57 -0000 Received: (qmail 8929 invoked by uid 500); 29 Jun 2007 10:54:13 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 8890 invoked by uid 500); 29 Jun 2007 10:54:13 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 8690 invoked by uid 99); 29 Jun 2007 10:54:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jun 2007 03:54:11 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jpoulton@verisign.com designates 216.168.239.75 as permitted sender) Received: from [216.168.239.75] (HELO osprey.verisign.com) (216.168.239.75) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jun 2007 03:54:08 -0700 Received: from dul1wnexcn03.vcorp.ad.vrsn.com (dul1wnexcn03.vcorp.ad.vrsn.com [10.170.12.113]) by osprey.verisign.com (8.13.6/8.13.4) with ESMTP id l5TApY4p006596 for ; Fri, 29 Jun 2007 06:51:34 -0400 Received: from BER2WNEXMB02.vcorp.ad.vrsn.com ([10.12.12.43]) by dul1wnexcn03.vcorp.ad.vrsn.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 29 Jun 2007 06:53:47 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Attribute question for Commons Digester Date: Fri, 29 Jun 2007 12:53:46 +0200 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Attribute question for Commons Digester Thread-Index: Ace6OwL8yK9ganGORK6wlILnUUhloQAAHAsg From: "Poulton, Jonathan" To: "Jakarta Commons Users List" X-OriginalArrivalTime: 29 Jun 2007 10:53:47.0012 (UTC) FILETIME=[C4C04440:01C7BA3B] X-Virus-Checked: Checked by ClamAV on apache.org You mean: digester.addObjectCreate("article", Article.class); digester.addSetProperties("article", "id", "id");=20 Yup. I've tried that. The actual value of the id field in the XML "_1234" is ignored and "0" is set on the Article id field instead. I assume that this is because of the underscore in the id field. -----Original Message----- From: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com] On Behalf Of James Carman Sent: 29 June 2007 11:48 To: Jakarta Commons Users List Subject: Re: Attribute question for Commons Digester Have you tried an ObjectCreate followed by a SetProperties? On 6/29/07, Poulton, Jonathan wrote: > > Surely someone has done this before? > > > -----Original Message----- > From: Poulton, Jonathan [mailto:jpoulton@verisign.com] > Sent: 28 June 2007 17:41 > To: commons-user@jakarta.apache.org > Subject: Digester problem > > Hi there, > I've tried finding a solution to what I think should be quite a simple > problem using the Commons Digester, but the tutorials I can find on=20 > the subject only really cover the basics and aren't of any help. > > Given an XML fragment like the following: > >
> ... >
> > I need the Digester to call a method on an Article class, with the=20 > following signiture: > > public void setId(long id); > > In other words I just need a Rule that will fire for an XML "id" > attribute, and remove an underscore from the front of a String before=20 > converting it to a long, and calling the appropriate method. > > I realise that this will require some kind of custom class to chop up=20 > the String, but the pattern you apply to matching the rule > ("article/id") appears to refer to a nested id element, rather than an > id attribute. > > I can't seem to find an example of this anywhere. All the custom rules > examples appear to refer to nested elements. Any suggestions? Have I=20 > missed something in the API? > > Cheers > > Jon > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org