commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: Portion of configuration handled by a different processor.
Date Tue, 15 Feb 2005 02:10:47 GMT
Hi Pratima,

On Mon, 2005-02-14 at 17:37 -0800, Gogineni, Pratima wrote:
> Hi,
> I have a weird requirement that Im trying to figure out how to address with
> the digester.

Firstly, could you please prefix your email subject lines with
[digester]? Because this is a list shared by multiple commons projects
that makes life easier for everyone.

> To Illustrate:
> <configuration>
> <config1...>
> <config2...>
> <handler>
> <type = "com.test.handler1"/>
> <extrainfo><tag1></tag1><config name="abc"/></extrainfo>
> </handler>
> <config3...>
> </configuration>
> I have rules created for config1, config2 and config3 tags in digester. when
> I hit the <handler> tag - I would like to instantiate com.test.Handler1 and
> pass the data under extrainfo as a  "String" or "Reader" or "InputStream" to
> the handler. 
> It would be preferable to pass the current stream rather than a string to my
> handler because i will also be processing the tags and would not like the
> overhead of converting this to a string and then reparsing.

I would suggest having a look at the CreateNodeRule, which can build a
DOM representation of a section of the input. That DOM can then be
passed to an arbitrary method on the top object on the digester stack
for processing.

If this doesn't suit, then I suggest you have a look at the source code
for CreateNodeRule; you might get inspiration for how to code a custom
Rule class of your own.

Before doing any of that, though, I suggest looking at the "plugins"
package for digester (esp. the package description page of the javadoc).
It might just do what you want.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message