You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "S. Asif Imam" <as...@protelnetworks.com.pk> on 2002/06/08 12:56:16 UTC

Problem regarding stringstream/ostringstream.??

Hi Friends....

A very critical problem, that I found after  spending much more time....

I am using Xalan transform  .
Making XSLTResultTarget like

std::ostringstream theStream
XSLTResultTarget theDOMResultTarget(&theStream);
or
std::stringstream theStream
XSLTResultTarget theDOMResultTarget(&theStream);

I have tried both ...

Trasnformation runs fine ..
but....
If the input source is larger  indirectly when ostringstream  has to
accomodate larger data, it simple returns Empty String.
When result is smaller in size it appears all right.

This problem never occoured when I tried on Window...
The problem appeared when the code is ported to Solaris.


Any workaround ? or Any one who faced same kind of problem ??

Any help regarding this is very much appreciated

Regards
Asif.









Re: Problem regarding stringstream/ostringstream.??

Posted by "S. Asif Imam" <as...@protelnetworks.com.pk>.
Great ..I resolved it .. Some thing again misguiding ..

Under Unix ....ostream pointer goes to end ..while writing ..dont know why
it stays at start under windows..

After calling transform ..and before getting data ..WE  need to move the
pointer to start ..calling seekp(0).

it looked like this ..

std::ostringstream theStream
XSLTResultTarget theDOMResultTarget(&theStream);
.......Tranasforming .....
theStream.seekp(0);
std::string stStr1 = theStream.str();
const char* processedRec  = stStr1.data();

Now you got the whole transformed data into Char* ...Do what ever you want
:)

Aisf ...

----- Original Message -----
From: "S. Asif Imam" <as...@protelnetworks.com.pk>
To: <xa...@xml.apache.org>
Sent: Saturday, June 08, 2002 3:56 PM
Subject: Problem regarding stringstream/ostringstream.??


> Hi Friends....
>
> A very critical problem, that I found after  spending much more time....
>
> I am using Xalan transform  .
> Making XSLTResultTarget like
>
> std::ostringstream theStream
> XSLTResultTarget theDOMResultTarget(&theStream);
> or
> std::stringstream theStream
> XSLTResultTarget theDOMResultTarget(&theStream);
>
> I have tried both ...
>
> Trasnformation runs fine ..
> but....
> If the input source is larger  indirectly when ostringstream  has to
> accomodate larger data, it simple returns Empty String.
> When result is smaller in size it appears all right.
>
> This problem never occoured when I tried on Window...
> The problem appeared when the code is ported to Solaris.
>
>
> Any workaround ? or Any one who faced same kind of problem ??
>
> Any help regarding this is very much appreciated
>
> Regards
> Asif.
>
>
>
>
>
>
>