You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Ceki Gülcü <ce...@qos.ch> on 2002/10/11 18:21:09 UTC

DOM-based Digester?

Has anyone thought of implementing Digester type functionality using the 
DOM API?


--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by Ceki Gülcü <ce...@qos.ch>.
Craig,

One can (easily?) convert a DOM tree into a SAX event stream but
that's not what I had meant. I meant writing a new tool leveraging the DOM
api to perform rule based XML processing a la commons-digester.

Has anyone given that some thought?

At 09:27 11.10.2002 -0700, Craig R. McClanahan wrote:

>On Fri, 11 Oct 2002, Ceki Gülcü wrote:
>
> > Date: Fri, 11 Oct 2002 18:21:09 +0200
> > From: Ceki Gülcü <ce...@qos.ch>
> > Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> > To: commons-dev@jakarta.apache.org
> > Subject: DOM-based Digester?
> >
> >
> > Has anyone thought of implementing Digester type functionality using the
> > DOM API?
> >
>
>I've never needed that, but in principle it sounds feasible -- all you'd
>need is something to convert the DOM into a stream of SAX events and you
>could reuse all the existing machinery.  I'm sure that problem has been
>solved by somebody before.
>
> >
> > --
> > Ceki
>
>Craig

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by Ceki Gülcü <ce...@qos.ch>.
Yes, this is precisely one of the advantages of DOM trees. You can easily 
deal with backward or forward references to other elements. Backward 
references are useful for lazy instantiation as you have mentioned.


At 15:56 11.10.2002 -0400, Jean-Francois Arcand wrote:
>One interesting uses is to create object "on demand", meaning not only 
>during the parsing of the file, but anytime you need to create an object 
>(you keep the DOM tree in memory). This mean you can applies more that one 
>object to the same set of rules without having to re-parse the file. You 
>just cache the dom tree in the Digester and re-use it when the parse 
>method is invoked.
>
>-- Jeanfrancois
>
>Ceki Gülcü wrote:
>
>>
>>At 00:37 12.10.2002 +0800, John Yu wrote:
>>
>>>At 12:21 am 12-10-2002, you wrote:
>>>
>>>>Has anyone thought of implementing Digester type functionality using 
>>>>the DOM API?
>>>
>>>
>>>Just curious: why does one need that?
>>
>>
>>Because rule based processing is useful regardless of whether SAX or DOM 
>>is being used. One objective advantage is that you can add new rules 
>>dynamically. You cannot do that with compiled Java.
>>
>>>--
>>>John Yu
>>
>>
>>--
>>Ceki
>>
>>TCP implementations will follow a general principle of robustness: be
>>conservative in what you do, be liberal in what you accept from
>>others. -- Jon Postel, RFC 793
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>so
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by Jean-Francois Arcand <jf...@apache.org>.
One interesting uses is to create object "on demand", meaning not only 
during the parsing of the file, but anytime you need to create an object 
(you keep the DOM tree in memory). This mean you can applies more that 
one object to the same set of rules without having to re-parse the file. 
You just cache the dom tree in the Digester and re-use it when the parse 
method is invoked.

-- Jeanfrancois

Ceki Gülcü wrote:

>
> At 00:37 12.10.2002 +0800, John Yu wrote:
>
>> At 12:21 am 12-10-2002, you wrote:
>>
>>> Has anyone thought of implementing Digester type functionality using 
>>> the DOM API?
>>
>>
>> Just curious: why does one need that?
>
>
> Because rule based processing is useful regardless of whether SAX or 
> DOM is being used. One objective advantage is that you can add new 
> rules dynamically. You cannot do that with compiled Java.
>
>> --
>> John Yu
>
>
> --
> Ceki
>
> TCP implementations will follow a general principle of robustness: be
> conservative in what you do, be liberal in what you accept from
> others. -- Jon Postel, RFC 793
>
>
>
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> so



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by Ceki Gülcü <ce...@qos.ch>.
At 00:37 12.10.2002 +0800, John Yu wrote:
>At 12:21 am 12-10-2002, you wrote:
>
>>Has anyone thought of implementing Digester type functionality using the 
>>DOM API?
>
>Just curious: why does one need that?

Because rule based processing is useful regardless of whether SAX or DOM is 
being used. One objective advantage is that you can add new rules 
dynamically. You cannot do that with compiled Java.

>--
>John Yu

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 11 Oct 2002, Ceki Gülcü wrote:

> Date: Fri, 11 Oct 2002 18:21:09 +0200
> From: Ceki Gülcü <ce...@qos.ch>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: commons-dev@jakarta.apache.org
> Subject: DOM-based Digester?
>
>
> Has anyone thought of implementing Digester type functionality using the
> DOM API?
>

I've never needed that, but in principle it sounds feasible -- all you'd
need is something to convert the DOM into a stream of SAX events and you
could reuse all the existing machinery.  I'm sure that problem has been
solved by somebody before.

>
> --
> Ceki

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DOM-based Digester?

Posted by John Yu <jo...@scioworks.com>.
At 12:21 am 12-10-2002, you wrote:

>Has anyone thought of implementing Digester type functionality using the 
>DOM API?


Just curious: why does one need that?

-- 
John Yu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>