cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kees Broenink" <kees.broen...@backbase.com>
Subject RE: Suggestion for XHTMLSerializer
Date Fri, 05 Aug 2005 13:12:59 GMT
√Čric,

I tried your solution described below but it does not solve the
<script></script> problem...

<script type="text/javascript" src="/bxs/3_0_1/bpc/boot.js"></script>

will return:

<script type="text/javascript" src="/bxs/3_0_1/bpc/boot.js"
xml:space="preserve" />

So IE is not happy.

Regards, Kees

-----------------
public class XMLSerializer2 extends AbstractTextSerializer {

    /**
     * Set the configurations for this serializer.
     */
    public void configure(Configuration conf)
    throws ConfigurationException {
        super.configure( conf );
    }

    /**
     * Set the {@link OutputStream} where the requested resource should
     * be serialized.
     */
    public void setOutputStream(OutputStream out) throws IOException {
        super.setOutputStream(out);
        try {
            TransformerHandler handler = this.getTransformerHandler();
            handler.getTransformer().setOutputProperties(this.format);
            handler.setResult(new StreamResult(this.output));
            this.setContentHandler(handler);
            this.setLexicalHandler(handler);
        } catch (Exception e) {
            final String message = "Cannot set XMLSerializer
outputstream"; 
            throw new CascadingIOException(message, e);
        }
    }

}

Now just configure this serializer in sitemap.xmap like you do with
regular XMLSerializer.

<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
src="org.apache.cocoon.serialization.XMLSerializer2">
                <doctype-public>-//W3C//DTD XHTML 1.0
Strict//EN</doctype-public>

<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</docty
pe-system>
                <encoding>UTF-8</encoding>
                <!-- for i6 compat mode-->
                <omit-xml-declaration>yes</omit-xml-declaration>
                <method>xhtml</method>
<transformer-factory>net.sf.saxon.TransformerFactoryImpl</transformer-fa
ctory>
</map:serializer>


Mime
View raw message