---- Matt Campbell <[EMAIL PROTECTED]> wrote: 
> I have the following simple xml file.
> 
> <security>
>      <security-sections>
>           <section>
>                <name>issueDetail</name>
>                <role>manager</role>
>                <role>user</role>
>           </section>


> How would I map the role elements to an arraylist named roles?

I suggest changing the SecuritySection class like this:
  SecuritySection.addRole(String role) {
    this.roles.add(role);
  }
after which the digester rule becomes trivial.

Alternatively you could change the input format to:
  <roles>
    <role>...</role>
    <role>...</role>
  </roles>
then use ObjectCreateRule to create the ArrayList on <roles> and CallMethodRule 
to invoke its add method on <role>

If you absolutely cannot do either of these, then I guess you can create the 
ArrayList at the section tag. The rule which sets the name attribute will then 
need to specify a "target offset" in order to access the SecuritySection object 
as it is no longer the top object on the stack. This is rather inelegant; I 
would recommend one of the other approaches instead.

Regards,

Simon



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

Reply via email to