cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Re: Change default encoding in the transformer
Date Mon, 10 Mar 2003 13:53:40 GMT
You're right.

But my transformer take a part of SAX events sent by the generator and 
parse it :

Here some lines of my transformer :

.....
public void endElement(String uri, String loc, String raw)
     throws SAXException {
         if (extractLevel == 0) {
             super.endElement(uri,loc,raw);
         } else {
             this.currentBuilder.endElement(uri,loc,raw);
             if (this.extractURI.equals(uri) && 
this.extractElement.equals(loc)) {
                 extractLevel--;
                 getLogger().debug("extractLevel now " + extractLevel + ".");
                 if (extractLevel == 0) {
                     // finish building the DOM. remove existing prefix 
mappings.
                     Iterator itt = prefixMap.entrySet().iterator();
                     while (itt.hasNext()) {
                         Map.Entry entry = (Map.Entry) itt.next();
                         this.currentBuilder.endPrefixMapping((String)entry.getKey());
                     }
                     this.currentBuilder.endDocument();
                     /**
                      * request in textml
                      */
                     Document doc  = this.currentBuilder.getDocument(); -> 
create the DOM document
                     String id   = null;
                     String stringQuery = null;
                     ByteArrayInputStream my_string_as_stream = null;
                     InputSource input_source = null;

                     this.request = new StringBuffer();
                     try {
                         this.format.put(OutputKeys.ENCODING, "UTF-16");
                         id = 
org.apache.cocoon.xml.XMLUtils.serializeNode(doc, this.format); -> 
serialized the DOM to a String
                         this.request.append(id);

....

That doesn't work...the is still have the header ISO-8859-1 encoding.





At 14:45 10/03/2003 +0100, you wrote:
>Lionel Crine <crine@4dconcept.fr> writes:
>
> > I'd like to change the default encoding in my custom transformer, how
> > can I do that ?
>
>How is a transformer related to encoding? It's a internal
>component and is working on java strings only (unless it is
>reading additional data  from a external source).
>Set the encoding in your serializer.
>
>Martin
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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


Mime
View raw message