commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Ruano Sánchez" <ruanonl...@gmail.com>
Subject Re: [Digester] Getting attribute from Rule begin method
Date Fri, 21 Apr 2006 17:00:20 GMT
I discovered what was happening! I've mixed the XMLs files I was using to
test my application and the one I was using hadn't any attributes in the
element. That's the reason why getLength() returned 0.

I notice that I was making a mistake when I saw that the attributes that the
Attributes object had where attributes from other elements and not from the
element I thought Digester was processing. Perhaps Digester use always the
same Attributes object...

I'm sorry for making you lose your time answering my mail :(. Thank you
anyway ;)

Carlos


On 4/21/06, Rahul Akolkar <rahul.akolkar@gmail.com> wrote:
>
> On 4/21/06, Carlos Ruano Sánchez <ruanonline@gmail.com> wrote:
> > Thank you for your response!
> >
> > I'm not using any VariableSubstitutor so I think that's not the reason
> of my
> > problem.
> >
> > I've tried again my code and I've got the same result: when I debug my
> > program, I can see all the attributes with their values inside the
> > Attributes object but when I try to get them, I get only nulls or empty
> > strings.
> >
> > How do you get the attribute names and values? Maybe I'm not using the
> > methods properly.
> >
> <snip/>
>
> <pseudo>
> public CustomRule extends Rule {
>
>   public final void begin(final String namespace, final String name,
>                                   final Attributes attributes) throws
> Exception {
>          String foo = attributes.getValue("foo");
>          // do something interesting with foo
>   }
>
>   // and so on ...
> }
> </pseudo>
>
> Maybe try to write a simplest test case that doesn't work for you?
>
> -Rahul
>
>
> > Thanks!
> >
> > Carlos
> >
> <snap/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message