commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [digester] multiple parent child relationships using xmlrules
Date Thu, 30 Jun 2005 02:53:55 GMT
On Thu, 2005-06-30 at 14:43 +1200, Simon Kitching wrote:
> > 
> > > Note however that digester rules typically operate on the top object on
> > > the stack. So you may find that pushing more than one of the objects you
> > > create onto the stack isn't useful.
> > 
> > That is exactly the problem. Inside one pattern I cannot add more than one 
> > object to the stack as popping only happens when the pattern ends. And not 
> > the rule...
> > 
> 
> Yep.

Umm..I meant Nope.

An ObjectCreateRule pushes an object when begin is executed and pops the
corresponding object when end is executed.

A pattern is nothing but a way to select a set of Rule objects.

Your issue is that you have multiple ObjectCreateRule instances
associated with a single pattern. All their begin methods fire when the
<x> element is matched, and all their end methods fire when </x> is
encountered. In between, there are multiple objects on the stack. This
behaviour is fundamental to Digester.

Note that I have a long-standing dislike of the xmlrules module, and
this is a clear example of why. If you were using the java API directly
then the way Rule objects and patterns work would be much more obvious. 

I suggest you look at the example code in the src/examples directory of
the source download to learn how digester's API works. This may then
shed some light on why your xmlrules definitions (ie rule definitions
specified in an xml file) work the way they do.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message