...Leszek Gawron wrote:
Sylvain Wallez wrote:
This is an interesting idea, which could be even more useful if the convertors were able not only to produce strings, but also XML snippets for output-only data. For example, we may want an email address to be rendered as a <a href="mailto.."> or negative numbers being displayed in red, or enclosed in parenthesis.
What that means is that a convertor should be able to do the following conversions:
- string+locale --> object : parsing request parameters
- object+locale --> string : producing the value of an input
- object+locale+channel --> xml fragment : producing the output view for a particular channel (html, wap, fo, etc).
If I would be able to choose convertors in the template (I mean on the same page render model entry in plain text and pretty printed) it would solve a LOT of my rendering problems. If convertors were pluggable I could also choose which convertor I would like to use in template itself.
How would this converters be plugged into template language? As components in cocoon.xconf?
Don't know yet. This is a [RT]! Maybe JXTG snippets for the object+local+channel --> xml fragment conversion?
Reminds me of XMLizer component. The only difference is, instead of InputStream it should work on arbitrary objects:
public interface XMLizer {
String ROLE = XMLizer.class.getName(); /**
* Generates SAX events from the given object
*/
void toSAX(Object object,
(*) String mimeType,
String systemID,
ContentHandler handler)
throws SAXException, IOException;
}
(*) Instead of mimeType some other kind of parameter might be needed
Vadim
