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 David Fishburn <fi...@ianywhere.com> on 2003/07/17 03:58:54 UTC

Need sample using ostream

Xalan 1.5
Xerces 2.2.0
WinXP
VC6 sp5

I am trying to write a wrapper DLL for transformations so that I can
embedded xalan in my application.

I have recompiled Xalan 1.5, Xerces 2.2.0.
I have also flipped through and tried some of the various examples.
I decided I would start with XalanTransform sample.

My C++ skills are pretty well novice.  I can usually deal with a sample
and modify it to get what I need working.  I have never used the
iostream class and am having serious difficulties.

Here is the problem.

XalanTransform will transform foo.xml and foo.xsl to either a specified
file, or to std out.
Since I will be calling transform() from a DLL, I need to have the
transformation done into a buffer.  Then I need to return that buffer to
my calling program.

XalanTransformer.hpp/XSLTResultTarget.hpp seems to indicate that they
only way to get the transform() method to use a buffer is to pass it a
StreamType, which is an std::ostream.

I can't seem to get this to compile or work correctly.
I was really hoping someone had something really simple that I could use
as an example.

Modifying XalanTransform sample to use an ostream would be perfect.
Instead of using cout, I would like it to create an ostream, have the
transform method use it.
Then print the output from it, since I will have to copy the contents of
the ostream to my own variable afterwards.

If this is the wrong mailing list to ask for this kind of help, please
let me know.

Thanks,
Dave


RE: Need sample using ostream

Posted by David Fishburn <fi...@ianywhere.com>.
Thanks for both of those suggestions.  That probably has enough to get
me working.

-----Original Message-----
From: david_n_bertoni@us.ibm.com [mailto:david_n_bertoni@us.ibm.com] 
Sent: Thursday, July 17, 2003 1:48 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Need sample using ostream






> I have recompiled Xalan 1.5, Xerces 2.2.0.
> I have also flipped through and tried some of the various examples. I 
> decided I would start with XalanTransform sample.
>
> My C++ skills are pretty well novice.  I can usually deal with a 
> sample and modify it to get what I need working.  I have never used 
> the iostream class and am having serious difficulties.
>
> Here is the problem.
>
> XalanTransform will transform foo.xml and foo.xsl to either a 
> specified file, or to std out. Since I will be calling transform() 
> from a DLL, I need to have the transformation done into a buffer.  
> Then I need to return that buffer to my calling program.

Did you look at the StreamTransform sample?

> Modifying XalanTransform sample to use an ostream would be perfect. 
> Instead of using cout, I would like it to create an ostream, have the 
> transform method use it. Then print the output from it, since I will 
> have to copy the contents of the ostream to my own variable 
> afterwards.

This will be really inefficient.  You should look at the
XalanTransformerCallback sample.  Using a callback will deliver the data
as it's produced, and you can store it directly into your variable.

Dave



Re: Need sample using ostream

Posted by da...@us.ibm.com.



> I have recompiled Xalan 1.5, Xerces 2.2.0.
> I have also flipped through and tried some of the various examples.
> I decided I would start with XalanTransform sample.
>
> My C++ skills are pretty well novice.  I can usually deal with a sample
> and modify it to get what I need working.  I have never used the
> iostream class and am having serious difficulties.
>
> Here is the problem.
>
> XalanTransform will transform foo.xml and foo.xsl to either a specified
> file, or to std out.
> Since I will be calling transform() from a DLL, I need to have the
> transformation done into a buffer.  Then I need to return that buffer to
> my calling program.

Did you look at the StreamTransform sample?

> Modifying XalanTransform sample to use an ostream would be perfect.
> Instead of using cout, I would like it to create an ostream, have the
> transform method use it.
> Then print the output from it, since I will have to copy the contents of
> the ostream to my own variable afterwards.

This will be really inefficient.  You should look at the
XalanTransformerCallback sample.  Using a callback will deliver the data as
it's produced, and you can store it directly into your variable.

Dave