You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Holger Floerke <fl...@doctronic.de> on 2002/07/22 12:57:32 UTC

Xalan-C: Two Ways to Transform into ByteStream

I use XalanTransformer for transformation. My stylesheet includes
<xsl:output method="html" encoding="iso-8859-1">. The result is about 1MB HTML.

If I use "ostringstream" as the ResultTarget

     ostringstream oResult;
     XSLTResultTarget oResultTarget(oResult);
...
     m_oTransformer.transform(...)
...

the rendering-time is two times larger than using "XalanDOMString"

     XalanDOMString oResult;
     DOMStringPrintWriter oDOMPrint(oResult);

     XSLTResultTarget oResultTarget(&oDOMPrint);
...
     m_oTransformer.transform(...)
...

I need a "single"-byte stream for output. Therefore I can't use 
XalanDOMString holding UTF-16 :^(

But I told the stylesheet to render "iso-8859-1". Can I go on with

       XalanDOMString::CharVectorType oLocal;
       oLocal.resize(oResult.size());
       for (XalanDOMString::size_type nI = 0; nI < oResult.size(); nI++)
       {
         oLocal[nI] = (char) oResult[nI];
       };
to convert XalanDOMString into single-byte array? What happens if there are 
characters above 255? Does the processor convert them to "&#...;"? If I 
have to use ostringstring: Can I preallocate the buffer?

TIA

HolgeR

-- 
holger floerke                     d  o  c  t  r  o  n  i  c
email floerke@doctronic.de         information publishing + retrieval
phone +49 2222 9292 90             http://www.doctronic.de