commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent Hale" <>
Subject I need access to bodyText in Digester or a addSetRoot which can get bodyText
Date Thu, 16 May 2002 15:23:21 GMT

In my particular situation I need to call a method on an object which is not
the top on on the stack and still get the body of the XML element being
processed.  It appears to me that the only way to ever gain access to the
body of the XML element being processed is through addCallMethod() passing
zero in as the paramCount.  But that only calls methods on an object on the
top of the stack.

I see a couple possible solutions and I hope someone else may have even
better ones.

1) Add a public String getBodyText() method to the digester.  I can then
push the digester itself on the bottom of the stack and thereby get access
to the XML body that way.

2) Create a new series of addCallMethod()'s which take an "int n" parameter.
If n were equal to 0 then it would behave like it does now.  If n == 1 then
it would execute the method on the next-to-top object on the stack and so on
down the line.  Then you could still pass in a paramCount of zero or

3) A variation on #2 above.  Only change is to call the new series of
addCallMethod()'s something different like addCallMethodN() or something so
as to not make so many variations of addCallMethod.

4) Another more drastic alternative would be to have all callbacks accept as
a first parameter the Digester and then still do #1 above.  That would break
a lot of code but make somethings a lot easier like collaborating with other
objects on the stack.  Hey...I'm only dreaming here.

But after all this...there may be another way of doing what I need that I am
just missing.  So any help would be appreciated.


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

View raw message