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: > > <map:generate type="html" src="request://parameters/parametername"/> > > ? > > 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 [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]