Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 73441 invoked by uid 500); 17 Oct 2002 07:49:22 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 73430 invoked from network); 17 Oct 2002 07:49:21 -0000 Message-ID: <3DAE6B4F.1030108@apache.org> Date: Thu, 17 Oct 2002 09:48:31 +0200 From: Nicola Ken Barozzi Reply-To: nicolaken@apache.org Organization: Apache Software Foundation User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: Re: Source vs. Generator References: <3DADBE56.6090506@cbim.it> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Ugo Cei wrote: > A long long time ago Carsten Ziegeler wrote: > >> 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. > > > After more than three months, I incurred in a scenario that might > justify the implementation of a RequestSource. > > Say you have an HTML form with a textarea field, where the user is > allowed to paste an HTML (not XHTML) fragment, maybe because he is using > some rich text editor that outputs a bunch of invalid HTML, like the MS > rich text editor for IE or Mozilla's ComposIte [1]. > > Moreover, say that you want to take this text and convert it to > well-formed XML with JTidy. You could do it all with some custom action > or XSP page or custom generator. But wouldn't it be much easier to just > write something like: > > > > ? > > Is there's an easier and more elegant alternative? And if there isn't > one, if I wrote this kind of Source, would it be useful to someone else > beside me? A Source is a way of obtaining a piece of information. A Generator is a way of converting it to XML. Since all Generators need to obtain a piece of information first, it's only logical that every Generator should work from data gotten from a Source. Sometimes it won't be practical, but conceptually it stands, and it adds a great deal of flexibility. As for the Request, we are used to it being an Object per se, but it's really an Object *holder*, a reference. So it's a way of obtaining Objects, not only an Object itself, so it should be repackaged as a Source. -- Nicola Ken Barozzi nicolaken@apache.org - verba volant, scripta manent - (discussions get forgotten, just code remains) --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org