On 4/21/06, Rahul Akolkar <[EMAIL PROTECTED]> wrote:
> On 4/21/06, Valerio Schiavoni <[EMAIL PROTECTED]> wrote:
> > Hello,
> > i have the following xml:
> > <root>
> > <element id="A">
> >   <subelement id="B"/>
> > </element>
> > </root>
> >
> > whenever I match path element/subelement, i need to invoke a 2-parameters
> > method  defined on the object on the stack
> > ,call it twoParamMethod(String idElement,String idSubElement).
> >
> > i was able to code up to this code:
> >
> > digester.addCallMethod("root/element/subelement", "twoParamMethod", 2);
> > //HOW DO I GET THE VALUE FOR THE FIRST PARAMETER ?
> <snip/>
>
> Personally, I wouldn't use CallMethodRule here, but I rarely use it
> anywhere. In this case, some options:
>
>  * Add a SetNextRule where you have access to both the "element" and
> "subelement", and therefore, all params to call the method
>
<snip/>

... or a SetTopRule.

>  * Add a custom rule that peeks one down the stack to find the
> "element" (custom rules are not hard, ofcourse if you can do what you
> need with "provided" rules, thats better most of the times)
>
> -Rahul
>
<snap/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to