cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <>
Subject Re: Do C1 & C2 coexist?
Date Tue, 29 Aug 2000 12:58:04 GMT

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

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.

View raw message