You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christopher Painter-Wakefield <pa...@mc.duke.edu> on 2003/12/12 17:52:33 UTC

dynamic setting of encoding on serializer?




Is there any way to dynamically set the encoding of output on a serializer,
specifically the XML serializer?  I have a customer who is having trouble
handing UTF-8 output from my application (he is using Lotus Notes), and
would like me to supply a different encoding.  I can just create a
different serializer with the encoding he wants, but he might need to try
more than one to get the desired result, and I don't want to create a
thousand serializer entries in my sitemap just so I can handle every
possible encoding (okay, I'm exaggerating).  I looked at the source
(C2.0.x) to see if I could create my own serializer to do this, but there
appears to be no easy way; the serializer don't implement
SitemapModelComponent, and thus don't get access to any of the usual
objects (e.g., parameters, objectModel).  Any thoughts?

-Christopher


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


Re: dynamic setting of encoding on serializer?

Posted by Jorg Heymans <jh...@domek.be>.
The fact that serializers don't accept parameters and don't have access 
to the objecmodel has come up before here and is indeed a pain.

Can you maybe add a node to the xml using a stylesheet transformer (they 
do accept parameters), and then filter out this node in the serializer 
and remove it from the xml before you serialize to the client.

Ofcourse for this to work you would need to override at least 
startdocument, enddocument, startelement and endelement to buffer the 
xml buildup before you modify it.

Admitted, it's a Big Bodge(tm), but it works. Alternatively, there is a 
patch waiting for the 2.1x branch that is supposed to add parameters for 
the SVG serializer. Maybe you can have a look how it's done and 
generalize it to the 2.0.x branch for any serializer.

Hope this helps
Jorg


Christopher Painter-Wakefield wrote:

> 
> 
> 
> Is there any way to dynamically set the encoding of output on a serializer,
> specifically the XML serializer?  I have a customer who is having trouble
> handing UTF-8 output from my application (he is using Lotus Notes), and
> would like me to supply a different encoding.  I can just create a
> different serializer with the encoding he wants, but he might need to try
> more than one to get the desired result, and I don't want to create a
> thousand serializer entries in my sitemap just so I can handle every
> possible encoding (okay, I'm exaggerating).  I looked at the source
> (C2.0.x) to see if I could create my own serializer to do this, but there
> appears to be no easy way; the serializer don't implement
> SitemapModelComponent, and thus don't get access to any of the usual
> objects (e.g., parameters, objectModel).  Any thoughts?
> 
> -Christopher
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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