Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 74690 invoked from network); 29 Aug 2000 12:58:04 -0000 Received: from web6203.mail.yahoo.com (128.11.22.114) by locus.apache.org with SMTP; 29 Aug 2000 12:58:04 -0000 Message-ID: <20000829125804.19442.qmail@web6203.mail.yahoo.com> Received: from [198.240.212.26] by web6203.mail.yahoo.com; Tue, 29 Aug 2000 05:58:04 PDT Date: Tue, 29 Aug 2000 05:58:04 -0700 (PDT) From: Giacomo Pati Reply-To: giacomo.pati@pwr.ch Subject: Re: Do C1 & C2 coexist? To: cocoon-dev@xml.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N --- Jeremy Quinn wrote: > At 23:51 +0200 28/08/00, Giacomo Pati wrote: > >Jeremy Quinn wrote: > >> > >> At 03:33 -0700 28/08/00, Giacomo Pati wrote: > >> >> BTW. Do PIs still work in C2? > >> > > >> >Definitely different. It's all done in the sitemap. Have a look > at it. > >> > >> So how do you do things like this, ( that I find very handy :) > >> > >if you have a special "as" selector do it with this pipeline > snippet: > > [snip] > > This looks very powerful, thanks for the explanation. > > Another question regarding porting FP taglib to C2, I make heavy use > of > XPath FP. I don't even know if XPath works with SAX. I assume if I > need to > use DOM, there is some utility method for outputting DOM to SAX. Yes, there are some utility classes to help converting. > Giacomo, you said something very tantalising the other day, > > >I personally think SAX is way easier that DOM! The only problem is > you > >have to think the other way around :) > > ( if you have time ... ) How, the other way around? Ok, as alway it depends on the view you have to look at you xml document. Let's start with the consumer view. With the DOM API it doesn't matter how you want to process your xml document. A parser gives you the DOM representation of the document and you can use it to travers it sequentially, peek some node or even modify it. You always have a convenient in-memory representation of the document. It's like randomly accessing a database. With SAX you must actively think of your processing pattern. Mainly you implement a ContentHandler and let a parser (or any other SAX producing object like a C2 component :) feed you with SAX events. You intercept all elements you are intrested in and build a representation of the data you've intercepted of any kind you can think of. But there is no easy way to manipulate it except you build a DOM out of the events or serialize them to a file or another ContentHandler. It's like processing a sequential tape file.