On Thu, 2006-06-22 at 15:45 -0500, Sloan, Noah M wrote:
> Is there a way to make the Digester call Rule's end() methods in the normal 
> order instead of reverse order?  Why does it do this?

No, there is no way to change the order. 

The "begin" method typically pushes stuff onto the object stack, and the
"end" method pops it back off again. Suppose two rules A and B both
match, and their begin methods both push objects onto the stack. A's end
method clearly cannot pop its data off the stack until B has done so
first.

In addition, A doesn't know how much data B has pushed. So if its end
method were to be called before B had cleaned up, it wouldn't know where
on the stack to find the data it pushed.

Hmm...it occurs to me that the body() method is called in exactly this
way (A before B), and therefore I presume that the body method really
shouldn't access the stack at all. If it can't access the stack, though,
then it can't do very much at all. I hadn't thought of this before. 

There is some related info regarding CallMethodRule and invocation order
in the FAQ:
  http://wiki.apache.org/jakarta-commons/Digester/FAQ
See the section titled:
  How do I get CallMethodRule to fire before SetNextRule?

Regards,

Simon


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

Reply via email to