cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Arbogast <sebastien.arbog...@gmail.com>
Subject Re: Injecting a String XML document into a pipeline
Date Sun, 05 Jun 2005 18:27:54 GMT
> By using the module source. The module source is a source which finds
> its input by using an input module. It can handle InputStreams, strings
> or byte arrays.
> 
> Start the pipeline with a generator like this:
> 
> <map:generate src="module:flow-attr:myxml"/>
> 
> But since you have the XML already completely as you want to send it to
> the client, you can directly use a reader which avoid the parsing and
> serializing:
> 
> <map:read src="module:flow-attr:myxml"/>
> 
> One possible issue might be encoding. If your XML string doens't contain
> an encoding declaration, then an XML parser will treat it as UTF-8 so
> the string should be converted to bytes using UTF-8. The module source
> however uses whatever the platform default encoding is, so to avoid
> problems it is better to convert to bytes already in your flowscript:
> 
> sendPage("...", {"myxml": myxmlvar.getBytes("UTF-8")});
> 
> (if your XML string does contain an encoding declaration, replace UTF-8
> by whatever it specifies)

Oh my god !!!
This is so clean it's perfect. Thank you very very very much !
That one should definitely be part of an FAQ about Cocoon... I'll add
it right now on Planet Cocoon. It's so bad input modules are not
better documented because obviously they can solve many issues.
Waouuuuh !

-- 
Sebastien ARBOGAST

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


Mime
View raw message