commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [Digester] How can I build a Calendar from XML pieces?
Date Sun, 06 Apr 2003 18:20:51 GMT
hi jason

(this answer will probably be a little vague since i don't know the 
structure of your objects.)

if i've understood you correctly, you need to create a calendar object. if 
this object is a bean (with a constructor which doesn't need to know the 
data and time information and setters for these properties) then you can 
probably create it with a rule mapped to <CreateDate> and then set the 
properties with BeanPropertySetterRule's mapped to <Date> and <Time>.

if the calendar isn't bean like and it configures itself by a method 
taking the <Date> and <Time> data, then you can use a CallMethodRule and 

if the calendar needs to have the date and time passed into the 
constructor, then i'm not sure any of the standard rules will work and you 
might need to create a custom Rule implementation.

hope this helps.

- robert

On Friday, April 4, 2003, at 07:21 PM, Jason Carreira wrote:

> Hi,
> I'm new to Digester and trying to replace some Castor XML binding with 
> Digester rules. We've got one complex XSD type which is a structure like 
> this:
>         <CreateDate>
>             <Date>2002-04-16</Date>
>             <Time>10:27:31.0</Time>
>         </CreateDate>
> In our current code, the <Date> element builds a Castor Date and the 
> <Time> element, which is optional, builds a Castor Time object. We've got 
> translation code which takes the year, month, and day from the Date 
> object and the time fields from the Time object (if it's there) and 
> builds a Calendar from it to be used in our domain models.
> I'm looking to bypass the Castor objects and translation and just build 
> our domain models from the XML using Digester. My current question is, 
> how would I go about translating the above structure into a Calendar? 
> Part of the problem is that the ObjectFactory stuff only takes attributes,
>  not sub-elements or the body text, otherwise I could create an 
> ObjectFactory.
> Thanks very much,
> Jason Carreira
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message