On Tue, 29 Jul 2003, Nitsche, Thomas wrote:
> Date: Tue, 29 Jul 2003 13:01:58 +0200
> From: "Nitsche, Thomas" <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [Digester] NodeCreateRule - doesn't pop() Node in the end()
>
> I need to use the NodeCreateRule to parse nested Elements with mixed content in my
> documents.
> As I always got NoSuchMethodExceptions somewhere after the NodeCreateRule executed,
> I took a look into the source code and found out, that NodeCreateRule does not
> overwrite the end() method of org.apache.commons.digester.Rule.
> But because of this, the Node does not get popped from the stack when the closing
> tag is reached.
> I think this is a bug because NodeCreateRule should behave the same way as
> ObjectCreateRule does.
>
> It worked fine after I derived the following class and used it instead of
> NodeCreateRule:
>
> public class MyNodeCreateRule extends NodeCreateRule {
>
> [ ... all the Contructors calling super(...) ...]
>
> public void end() throws Exception {
> Object top = digester.pop();
> }
> }
>
>
> Is this a bug or did I just use this rule in the wrong way?
Sorry for the late response on this (I'm not normally a user of
NodeCreateRule). I think your analysis of the situation is correct, so I
just applied the corresponding patch to NodeCreateRule itself and things
seem to work as one would expect -- the Node is on the stack for the
duration of the set of rules that all match the initial pattern, and then
it's popped off. Even the unit tests still continue to work, so I'm
committing the change for people to play with. It will show up in the
20030817 nightly build of Digester tonight.
Thomas, I'd appreciate it if you could try this out in your application
and report back on success or probems.
> Thomas
>
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]