commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: [Digester] How can I build a Calendar from XML pieces?
Date Mon, 07 Apr 2003 17:44:59 GMT

On Mon, 7 Apr 2003, Jason Carreira wrote:

> Date: Mon, 07 Apr 2003 12:46:30 -0400
> From: Jason Carreira <>
> Reply-To: Jakarta Commons Users List <>
> To: Jakarta Commons Users List <>
> Newsgroups: gmane.comp.jakarta.commons.user
> Subject: Re: [Digester] How can I  build a Calendar from XML pieces?
> Is there any way to build re-usable components which have sub-rules?
> i.e., if I created a CalendarRule, could I have it have sub-rules which
> would get events for the <date> and <time> elements below the root which
>   the CalendarRule is added to watch, no matter what path that was added
> to monitor? Or do I have to create those other rules and always put them
> into the digester by hand?

Digester includes the concept of a RuleSet, which is an encapsulated group
of Rule configurations that are installed into a Digester as a unit.  As
an example of using this, Tomcat 4.1's mechanism for reading server.xml
files leverages this in a manner similar to what you are talking about --
I'd suggest downloading the 4.1 sources and looking at class
org.apache.catalina.startup.Catalina to see how the Digester rules are

The concept that is similar to your requirements is that the subrules
inside a <Context> can appear at different places in the XML document
hierarchy.  Tomcat encapsulates all the subrules into a single
ContextRuleSet that can be attached to several different matching rule

Building a set of Calendar subrules would be a lot simpler, but you can
leverage the same concept of a RuleSet that takes the prefix of a matching
rule as one of its constructor arguments.

> Jason


View raw message