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 <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> 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:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to