commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: [DIGESTER] Newbie question
Date Sat, 03 Apr 2004 22:41:45 GMT
Richard HALLIER wrote:

>Hi all,
>I've a simple problem, and I cant manage to resolve it, what are the
>digester rules for the follwing reccurent pattern :
><ressource type="page" id="item.entite">
>	<locator type="label" value="zobilamouche"/>
>	<ressource type="form" id="formID">
>		<locator type="name" value="entityForm"/>
>	</ressource>
>I've added the following methods to the Ressouce class :
>addRessource(Ressource re) and setParent(Ressource re)
>Thank you for your precious help.
You can use patterns like "*/ressource" and "*/locator" to match those 
elements, no matter how deeply they are nested.  So, you might have 
rules like this:

  digester.addObjectCreate("*/ressource", "com.mycompany.Ressource");
  digester.addCallNext("*/ressource", "com.mycompany.Ressource");

(I would have the call to setParent() happen inside the addRessource() 
method, instead of requiring both to be done by Digester rules).

Because these rules will be fired for even the outermost <ressource> 
element, you'll want to push a Ressource object onto the digester stack 
before you start parsing.


PS:  If "ressource" is supposed to be in English, it's actually spelled 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message