logancillo wrote:
hi everybody, i have this code

<code>
...
// Do the transform.
        int theResult = theXalanTransformer.transform(&theXMLStream,
inputXSLSource, theOutputStream);
        const char * cadena = theOutputStream.str();
        cout<<"ANTES---->"<<endl<<cadena<<endl;
The string return from the stream is not null-terminated, so I suspect you will see some garbage characters on the screen after the actual result. Make sure you append a null-terminator to the stream, before you call str():
         theOutputStream << '\0';
         const char * cadena = theOutputStream.str();


        salida= env->NewStringUTF(cadena);
        cout<<"DESPUES---->"<<salida<<endl;
...

</code>

This code realizes his work, which is to take the chains of characters of
the xml and the insole xsl and to realize the transformation in html. The
problem is that when the html generated by the screen goes out they go out
strange characters, something like this:



If you see these characters after the output you expect, the problem is the string was not null-terminated, as I mentioned before.


It seems as if the theOutputStream object had the transformation stored in
an internal static buffer and when I return the bulging chain it was not
finished with \n\r or worse, that this treading on memory not reserved
adequately.
I'm sorry, but I don't really understand what you mean here. Xalan-C does not use any internal static buffers to store the serialized HTML, and I doubt very much this is the result of a buffer overrun.

I know that xml and xsl templates are correct because is being used in other
app version which uses xalanj as xslt engine.
Then I suspect your code is at fault.

Dave

Reply via email to