commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject RE: [digester] relative patterns
Date Tue, 13 Nov 2001 19:33:51 GMT
There are two things you should take a look at in the documentation:

* Using the "*" in a matching pattern ("*/a" matches <a> no matter
  where it is nested)

* The ability to write your own implementation of matching by defining
  a "Rules" implementation.

I would not personally implement your "the previous path" pattern -- it
makes setting up the rules very fragile if you switch the order of your
addRule() statements around.  But you can do it yourself.

For re-use of existing sets of rules, check out the RuleSet class as well.
Tomcat makes good use of this mechanism, because there are multiple places
at which the same set of rules should be applied (but with different
prefixes to the matching patterns).

Craig


On Tue, 13 Nov 2001, Tal Dayan wrote:

> Date: Tue, 13 Nov 2001 11:14:05 -0800
> From: Tal Dayan <tal@zapta.com>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: RE: [digester] relative patterns
>
> Hello,
>
>
> It looks like Digester accepts built in rules only with absolute patterns
> such as
>
>     digester.addSomeRule("aa"
>     digester.addSomeRule("aa/bb/cc"
>     digester.addSomeRule("aa/bb"
>
> which requires some work when moving things around the hierarchy.
>
> How about adding support for relative patterns like (very rough syntax):
>
>     digester.setBase("/aa")
>     digester.addSomeRule("."            --> /aa
>     digester.addSomeRule("./bb/cc"      --> /aa/bb/cc
>     digester.addSomeRule("!"            --> /aa/bb/cc  (the previous path)
>     digester.addSomeRule("!/../dd"      --> /aa/bb/dd
>
> This will affect only the creation of the rules and will not add overhead to
> the actual parsing of the XML document.
>
> Tal
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message