You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peng Tuck Kwok <pe...@makmal.net> on 2003/02/13 07:59:18 UTC

Digester question

Is it possible to handle duplicate elements in commons digester using 
the following example ?


<phonebook>
	<entry>
	 <owner>Owner</owner>
	 <number>Number</number>
	 [ and many other numbers to follow..]
	 </entry>
</phonebook>

I can handle many <entry> elements but can't quite yet grasp how to do 
the multiple number elements. Does anyone have any idea how to do this ?


RE: Digester question

Posted by Mingfai Ma <mi...@hongkong.com>.
I hope the following can help. In digester, you add rules to handle any
element. for example, you can use two rules:
          digester.addRule( "phonebook/entry", new ObjectCreationRule(
"package.name.Entry" ) );
          digester.addRule( "phonebook/entry/number", new
BeanPropertySetterRule("numberField") );
the first rule to handle the 'entry' element and the 2nd for 'number'. The
rules are example and you can use any rules.

I'm not very good in Digester. Please ask others if the above cannot help.

regards,
mingfai



> -----Original Message-----
> From: Peng Tuck Kwok [mailto:pengtuck@makmal.net]
> Sent: Thursday, February 13, 2003 2:59 PM
> To: commons-user@jakarta.apache.org
> Subject: Digester question
>
>
> Is it possible to handle duplicate elements in commons digester using
> the following example ?
>
>
> <phonebook>
> 	<entry>
> 	 <owner>Owner</owner>
> 	 <number>Number</number>
> 	 [ and many other numbers to follow..]
> 	 </entry>
> </phonebook>
>
> I can handle many <entry> elements but can't quite yet grasp how to do
> the multiple number elements. Does anyone have any idea how to do this ?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>