commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gogineni, Pratima" <pgogin...@selectica.com>
Subject RE: [digester] Portion of configuration handled by a different pr ocessor.
Date Tue, 15 Feb 2005 18:12:29 GMT
Sorry about that I have now added digester in the subject.

I think a custom rule class similar to the nodecreaterule will work in my
scenario. The plugin still seems to assume that digester would be handling
the rules for the plugin classes (even though we get the flexibility of
adding these rules dynamically). 

Thanks
Pratima

-----Original Message-----
From: Simon Kitching [mailto:skitching@apache.org]
Sent: Monday, February 14, 2005 6:11 PM
To: Jakarta Commons Users List
Subject: Re: Portion of configuration handled by a different processor.


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.

Regards,

Simon



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

---------------------------------------------------------------------
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