It's not that bad either ;-)

You need to write a rule that overrides the ContentHandler used by the 
XMLReader that Digester is using - which a rule has full read/write 
access to. That custom content handler creates the DOM of the element 
that triggered the rule. When the content handler encounters the end of 
the element it had started with, it gives control back to Digester.

Actually, I've implemented such a creature last week or so, although a 
bit different: Triggered on some element, it builds a DOM 
DocumentFragment of all content *beneath* the element it was triggered 
on, and pushes that DocumentFragment on Digester's stack.

I could cleanup the code and submit a patch, if there's interest (and a 
committer with some spare time to look at it ;-))...

Scott Sanders wrote:
> AFAIK, this is not possible with Digester today.  I suppose you could
> write rules to stream events and build up an Element node, but that is a
> lot of work.
> 
> I would say that it is 'possible', but not terribly easy.
 >
> Scott
> 
> 
>>-----Original Message-----
>>From: Jim Birchfield [mailto:[EMAIL PROTECTED]] 
>>Sent: Tuesday, September 10, 2002 5:03 AM
>>To: [EMAIL PROTECTED]
>>Subject: Digester and XML Elements
>>
>>
>>I have been using Digester for a while and love it.  However 
>>I am try to do something I have not seen an example of and 
>>cannot seem to figure out how to do it.  I need to grab a 
>>portion of my config file as the raw XML.  I want to be able 
>>to invoke a method passing in an Element object (or even a 
>>string if necessary) of a piece of XML in my file.  Is that 
>>possible with Digester today?

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


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

Reply via email to