cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: Source vs. Generator
Date Thu, 04 Jul 2002 09:37:08 GMT
Carsten Ziegeler wrote:

>And to add more complexity, we have a XMLizer! What's that?
>
>Now, as Sylvain explains a Source delivers data in any format
>which might not be XML. To classify the format of the data,
>mime-types are used, so a Source can return the mime-type
>of the data, for example "text/html" etc.
>
>The XMLizer is a (guess what) configurable Avalon component
>which knows how to convert some mime-types to XML, for example
>it can convert "text/html" to XHTML (using jtidy).
>  
>

Damn, I missed that one !

>The Cocoon SourceResolver checks (as Sylvain has explained) in
>the toSAX(Source) method, if the Source is itself XMLizable,
>which means if the Source can convert itself (or it's data)
>to an XML representation). If this is not the case, the 
>XMLizer is used. It get's the mime-type from the source and
>looks if it has a mapping for this mime-type to XML. If so
>this mapping is used.
>If the source does not return a mime-type, it's assumed that
>the source already delivers XML and the XML parser is used
>on the content.
>
>So, if you look at this scenario, there is actually no need
>for special generators like the SWFGenerator mentioned below,
>because the XMLizer could be extended by this conversion and
>then the usual FileGenerator could be used as well.
>  
>

But this works only if the source is capable of determining the 
mime-type, which isn't always obvious (consider for example the BlobSource).

>And now the final attack:
>Nearly all generators could be rewritten as sources, for
>example the RequestGenerator could be written as a "request:"
>protocol. But does this make sense - I would say: "No". I 
>think a protocol makes sense if several, different sources
>(documents, pieces of information) can be obtained using this
>protocol. For example using an FTP protocol you can fetch
>several files from the FTP server.
>A request protocol for example addresses only one piece of
>information, the request.
>

Agree. Moreover, writing a source makes sense only if the data it 
provides can be used for other purposes than a generator. An XSL 
stylesheet can be fetched from an FTP server, but I can hardly think of 
fetching a stylesheet from the request !

>Ok, can someone add more "confusion"? ;)
>

Maybe Jeremy could tell us that slash-edit allows to read stylesheets 
from the request ;)

>And yes, Sylvain, this should really go in the docs!
>  
>

Ok. I'll assemble this in an xdoc.

Sylvain

-- 
Sylvain Wallez
  Anyware Technologies                  Apache Cocoon
  http://www.anyware-tech.com           mailto:sylvain@apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message