auriemma 00/08/30 07:59:29
Modified: c/samples/CompileStylesheet CompileStylesheet.cpp
Log:
Made a minor change to support UNIX platforms.
Revision Changes Path
1.10 +24 -8
xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp
Index: CompileStylesheet.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- CompileStylesheet.cpp 2000/08/29 17:13:58 1.9
+++ CompileStylesheet.cpp 2000/08/30 14:59:27 1.10
@@ -1,20 +1,30 @@
// Base header file. Must be first.
#include <Include/PlatformDefinitions.hpp>
+
+
#include <cassert>
#include <fstream>
#include <iostream>
#include <strstream>
+
+
#include <util/PlatformUtils.hpp>
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
#include <DOMSupport/DOMSupportDefault.hpp>
+
+
#include <XPath/XObjectFactoryDefault.hpp>
#include <XPath/XPathSupportDefault.hpp>
#include <XPath/XPathFactoryDefault.hpp>
+
+
#include <XSLT/StylesheetConstructionContextDefault.hpp>
#include <XSLT/StylesheetExecutionContextDefault.hpp>
#include <XSLT/StylesheetRoot.hpp>
@@ -23,8 +33,12 @@
#include <XSLT/XSLTProcessorEnvSupportDefault.hpp>
#include <XSLT/XSLTResultTarget.hpp>
+
+
#include <XercesParserLiaison/XercesParserLiaison.hpp>
+
+
#include <XercesPlatformSupport/TextFileOutputStream.hpp>
#include <XercesPlatformSupport/XercesDOMPrintWriter.hpp>
@@ -76,9 +90,9 @@
// Connect the processor to the support object...
theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
- // Create a separate XPath factory support object so the
- // stylesheet's factory-created XPath instances are
independent
- // from the processor's.
+ // Create separate factory support objects so the
stylesheet's
+ // factory-created XPath instances are independent from
the
+ // processor's.
XPathFactoryDefault
theStylesheetXPathFactory;
// Create a stylesheet construction context, using the
@@ -101,6 +115,10 @@
// from same directory as the input files.
const XalanDOMString
theXMLFileName("foo.xml");
const XalanDOMString
theXSLFileName("foo.xsl");
+
+ // Buffers passed in to ostrstream.
+ char inBuffer[10];
+ char outBuffer[10];
// Our stylesheet input source...
XSLTInputSource
theStylesheetSource(c_wstr(theXSLFileName));
@@ -120,17 +138,15 @@
theExecutionContext.setStylesheetRoot(theStylesheetRoot);
// Generate the input and output file names.
- ostrstream theFormatterIn, theFormatterOut;
+ ostrstream theFormatterIn(inBuffer,
sizeof(inBuffer));
+ ostrstream theFormatterOut(outBuffer,
sizeof(outBuffer));
+
theFormatterIn << "foo" << i + 1 << ".xml" <<
'\0';
theFormatterOut << "foo" << i + 1 << ".out" <<
'\0';
//Generate the XML input and output objects.
XSLTInputSource
theInputSource(theFormatterIn.str());
XSLTResultTarget
theResultTarget(theFormatterOut.str());
-
- // Unfreeze the ostrstreams, so the memory is
returned...
- theFormatterIn.freeze(false);
- theFormatterOut.freeze(false);
// Do the tranformation...
theProcessor.process(