I believe this is a general C++ I/O questions rather than a Xalan one.

I'm not entirely clear what you require, but  an ostream is acceptable for
the result parameter.  You can buffer the result by using a stringstream.
For example, XalanTransform:

1.  add "#include <sstream>"
2.  For the transformation, instead of:

      theResult = theXalanTransformer.transform(argv[1], argv[2], cout);

    Change to:

      std::ostringstream result;
      theResult = theXalanTransformer.transform(argv[1],argv[2],result);
      cout << result.str()
      std::string resultString = result.str();  // etc...

Matthew Hoyt
IBM Toronto Lab
email: [EMAIL PROTECTED]



                                                                                
       
                      "David Fishburn"                                          
       
                      <[EMAIL PROTECTED]        To:                             
        
                      re.com>                   <[email protected]>  
       
                                               cc:                              
       
                      07/16/2003 09:58         Subject:  Need sample using 
ostream     
                      PM                                                        
       
                                                                                
       
                                                                                
       




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




Reply via email to