You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/04/25 21:54:32 UTC

cvs commit: xml-xalan/c/src/XSLT StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp StylesheetRoot.cpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp XSLTInputSource.cpp XSLTInputSource.hpp XSLTResultTarget.cpp XSLTResultTarget.hpp

dbertoni    00/04/25 12:54:30

  Modified:    c/src/XSLT StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetRoot.cpp XSLTEngineImpl.cpp
                        XSLTEngineImpl.hpp XSLTInputSource.cpp
                        XSLTInputSource.hpp XSLTResultTarget.cpp
                        XSLTResultTarget.hpp
  Log:
  Changes to hide the creation of PrintWriters.  Changes to make StylesheetConstructionContext responsible for the lifetime of stylesheets.  Implemented other input source options in XSLTInputSource and other output source options in XSLTResultTarget.
  
  Revision  Changes    Path
  1.4       +43 -1     xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StylesheetConstructionContext.hpp	2000/04/11 15:09:29	1.3
  +++ StylesheetConstructionContext.hpp	2000/04/25 19:54:13	1.4
  @@ -74,8 +74,10 @@
   
   
   class PrefixResolver;
  -class XPath;
  +class StylesheetRoot;
   class XMLURL;
  +class XPath;
  +class XSLTInputSource;
   
   
   
  @@ -92,6 +94,46 @@
   
   	virtual
   	~StylesheetConstructionContext();
  +
  +
  +	/**
  +	 * Reset the StylesheetConstructionContext instance.  Any existing objects
  +	 * created by the instance will be destroyed.
  +	 */
  +	virtual void
  +	reset() = 0;
  +
  +	/**
  +	 * Create a new StylesheetRoot instance.  The StylesheetConstructionContext
  +	 * instance owns the StylesheetRoot instance, and will delete it when asked
  +	 * or when the StylesheetConstructionContext instance is destroyed.
  +	 *
  +	 * @param theBaseIdentifier A URI to the stylesheet file.
  +	 * @return A pointer to a new StylesheetRoot instance.
  +	 */
  +	virtual StylesheetRoot*
  +	create(const XalanDOMString&	theBaseIdentifier) = 0;
  +
  +	/**
  +	 * Create a new StylesheetRoot instance.  The StylesheetConstructionContext
  +	 * instance owns the StylesheetRoot instance, and will delete it when asked
  +	 * or when the StylesheetConstructionContext instance is destroyed.
  +	 *
  +	 * @param theInputSource A reference to the input source.
  +	 * @return A pointer to a new StylesheetRoot instance.
  +	 */
  +	virtual StylesheetRoot*
  +	create(XSLTInputSource&		theInputSource) = 0;
  +
  +	/**
  +	 * Destroy a StylesheetRoot instance.  If this StylesheetConstructionContext
  +	 * instance does not own the StylesheetRoot, it will not delete the
  +	 * StylesheetRoot.
  +	 *
  +	 * @param theStylesheet A pointer to the StylesheetRoot instance to delete.
  +	 */
  +	virtual void
  +	destroy(StylesheetRoot*		theStylesheetRoot) = 0;
   
   	/**
   	 * Given an XSL tag name, return an integer token that corresponds to
  
  
  
  1.3       +71 -1     xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StylesheetConstructionContextDefault.cpp	2000/04/11 15:09:29	1.2
  +++ StylesheetConstructionContextDefault.cpp	2000/04/25 19:54:14	1.3
  @@ -59,6 +59,14 @@
   
   
   
  +#include <algorithm>
  +
  +
  +
  +#include <PlatformSupport/STLHelper.hpp>
  +
  +
  +
   #include <XPath/XObjectFactory.hpp>
   #include <XPath/XPathEnvSupport.hpp>
   #include <XPath/XPathFactory.hpp>
  @@ -66,7 +74,9 @@
   
   
   
  +#include "StylesheetRoot.hpp"
   #include "XSLTEngineImpl.hpp"
  +#include "XSLTInputSource.hpp"
   
   
   
  @@ -80,7 +90,8 @@
   	m_xpathEnvSupport(xpathEnvSupport),
   	m_xobjectFactory(xobjectFactory),
   	m_xpathFactory(xpathFactory),
  -	m_xpathProcessor(new XPathProcessorImpl)
  +	m_xpathProcessor(new XPathProcessorImpl),
  +	m_stylesheets()
   {
   }
   
  @@ -88,6 +99,7 @@
   
   StylesheetConstructionContextDefault::~StylesheetConstructionContextDefault()
   {
  +	reset();
   }
   
   
  @@ -121,6 +133,64 @@
   			const XalanNode*		styleNode) const
   {
   	m_processor.message(msg, styleNode, sourceNode);
  +}
  +
  +
  +
  +void
  +StylesheetConstructionContextDefault::reset()
  +{
  +#if !defined(XALAN_NO_NAMESPACES)
  +	using std::for_each;
  +#endif
  +
  +	for_each(m_stylesheets.begin(),
  +			 m_stylesheets.end(),
  +			 DeleteFunctor<StylesheetRoot>());
  +}
  +
  +
  +
  +StylesheetRoot*
  +StylesheetConstructionContextDefault::create(const XalanDOMString&	theBaseIdentifier)
  +{
  +	StylesheetRoot* const	theStylesheetRoot =
  +		new StylesheetRoot(theBaseIdentifier, *this);
  +
  +	m_stylesheets.insert(theStylesheetRoot);
  +
  +	return theStylesheetRoot;
  +}
  +
  +
  +
  +StylesheetRoot*
  +StylesheetConstructionContextDefault::create(XSLTInputSource&	theInputSource)
  +{
  +	const XMLCh* const	theSystemID =
  +				theInputSource.getSystemId();
  +
  +	const XalanDOMString	theBaseIdentifier =
  +				theSystemID == 0 ? XALAN_STATIC_UCODE_STRING("") :
  +				theSystemID;
  +
  +	return create(theBaseIdentifier);
  +}
  +
  +
  +
  +void
  +StylesheetConstructionContextDefault::destroy(StylesheetRoot*	theStylesheetRoot)
  +{
  +	const StylesheetSetType::iterator	i =
  +		m_stylesheets.find(theStylesheetRoot);
  +
  +	if (i != m_stylesheets.end())
  +	{
  +		m_stylesheets.erase(i);
  +
  +		delete theStylesheetRoot;
  +	}
   }
   
   
  
  
  
  1.4       +24 -6     xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StylesheetConstructionContextDefault.hpp	2000/04/11 15:09:29	1.3
  +++ StylesheetConstructionContextDefault.hpp	2000/04/25 19:54:14	1.4
  @@ -70,6 +70,7 @@
   
   
   #include <memory>
  +#include <set>
   
   
   
  @@ -122,6 +123,18 @@
   
   	// These interfaces are inherited from StylesheetConstructionContext...
   
  +	virtual void
  +	reset();
  +
  +	virtual StylesheetRoot*
  +	create(const XalanDOMString&	theBaseIdentifier);
  +
  +	virtual StylesheetRoot*
  +	create(XSLTInputSource&		theInputSource);
  +
  +	virtual void
  +	destroy(StylesheetRoot*		theStylesheetRoot);
  +
   	virtual int
   	getAttrTok(const XalanDOMString&	name) const;
   
  @@ -151,17 +164,22 @@
   
   private:
   
  -	XSLTEngineImpl&					m_processor;
  -	XPathEnvSupport&				m_xpathEnvSupport;
  -	XObjectFactory&					m_xobjectFactory;
  -	XPathFactory&					m_xpathFactory;
  +	XSLTEngineImpl&						m_processor;
  +	XPathEnvSupport&					m_xpathEnvSupport;
  +	XObjectFactory&						m_xobjectFactory;
  +	XPathFactory&						m_xpathFactory;
   
   #if defined(XALAN_NO_NAMESPACES)
  -	auto_ptr<XPathProcessor>		m_xpathProcessor;
  +	auto_ptr<XPathProcessor>			m_xpathProcessor;
  +
  +	typedef set<StylesheetRoot*>		StylesheetSetType;
   #else
  -	std::auto_ptr<XPathProcessor>	m_xpathProcessor;
  +	std::auto_ptr<XPathProcessor>		m_xpathProcessor;
  +
  +	typedef std::set<StylesheetRoot*>	StylesheetSetType;
   #endif
   
  +	StylesheetSetType					m_stylesheets;
   };
   
   
  
  
  
  1.8       +54 -0     xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StylesheetExecutionContext.hpp	2000/04/20 16:47:35	1.7
  +++ StylesheetExecutionContext.hpp	2000/04/25 19:54:14	1.8
  @@ -64,6 +64,11 @@
   
   
   
  +// std stream forward declarations.
  +#include <iosfwd>
  +
  +
  +
   // Base class header file...
   #include <XPath/XPathExecutionContext.hpp>
   
  @@ -83,9 +88,11 @@
   class FormatterListener;
   class PrefixResolver;
   class NodeRefListBase;
  +class PrintWriter;
   class QName;
   class Stylesheet;
   class StylesheetRoot;
  +class TextOutputStream;
   class XalanElement;
   class XalanNode;
   class XalanDocument;
  @@ -110,6 +117,13 @@
   	// These interfaces are new...
   
   	/**
  +	 * Reset the instance, and prepare to re-use the
  +	 * context.
  +	 */
  +	virtual void
  +	reset() = 0;
  +
  +	/**
   	 * Retrieve a top level variable corresponding to name.
   	 * 
   	 * @param name name of variable
  @@ -1145,6 +1159,46 @@
   	 */
   	virtual const DecimalFormatSymbols*
   	getDecimalFormatSymbols(const XalanDOMString&	name) = 0;
  +
  +	/**
  +	 * Create a PrintWriter to represent the supplied TextOutputStream.
  +	 * The StylesheetExecutionContext owns the PrintWriter, and will
  +	 * delete it when reset(), or during destruction.
  +	 *
  +	 * @param theOutputStream the output stream.
  +	 * @return the new PrintWriter instance.
  +	 */
  +	virtual PrintWriter*
  +	createPrintWriter(TextOutputStream*		theTextOutputStream) = 0;
  +
  +	/**
  +	 * Create a PrintWriter to represent the supplied std::ostream.
  +	 * The StylesheetExecutionContext owns the PrintWriter, and will
  +	 * delete it when reset(), or during destruction.
  +	 *
  +	 * @param theFileName the name of the output file.
  +	 * @param theEncoding the encoding to use.
  +	 * @return the new PrintWriter instance.
  +	 */
  +	virtual PrintWriter*
  +	createPrintWriter(
  +			const XalanDOMString&		theFileName,
  +			const XalanDOMString&		theEncoding) = 0;
  +
  +	/**
  +	 * Create a PrintWriter to represent the supplied std::ostream.
  +	 * The StylesheetExecutionContext owns the PrintWriter, and will
  +	 * delete it when reset(), or during destruction.
  +	 *
  +	 * @param theStream a reference to an ostream.
  +	 * @return the new PrintWriter instance.
  +	 */
  +	virtual PrintWriter*
  +#if defined(XALAN_NO_NAMESPACES)
  +	createPrintWriter(ostream&			theStream) = 0;
  +#else
  +	createPrintWriter(std::ostream&		theStream) = 0;
  +#endif
   
   	// These interfaces are inherited from ExecutionContext...
   
  
  
  
  1.7       +91 -1     xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StylesheetExecutionContextDefault.cpp	2000/04/20 16:47:35	1.6
  +++ StylesheetExecutionContextDefault.cpp	2000/04/25 19:54:15	1.7
  @@ -64,6 +64,11 @@
   
   
   
  +#include <PlatformSupport/STLHelper.hpp>
  +#include <PlatformSupport/TextOutputStream.hpp>
  +
  +
  +
   #include <XPath/ElementPrefixResolverProxy.hpp>
   #include <XPath/ResultTreeFragBase.hpp>
   #include <XPath/XPathExecutionContext.hpp>
  @@ -75,6 +80,13 @@
   
   
   
  +// Yuck, these really shouldn't be here...
  +#include <XercesPlatformSupport/XercesDOMPrintWriter.hpp>
  +#include <XercesPlatformSupport/XercesStdTextOutputStream.hpp>
  +#include <XercesPlatformSupport/TextFileOutputStream.hpp>
  +
  +
  +
   #include "StylesheetRoot.hpp"
   #include "XSLTEngineImpl.hpp"
   
  @@ -98,7 +110,9 @@
   	m_xsltProcessor(xsltProcessor),
   	m_elementRecursionStack(),
   	m_prefixResolver(0),
  -	m_stylesheetRoot(0)
  +	m_stylesheetRoot(0),
  +	m_printWriters(),
  +	m_textOutputStreams()
   {
   }
   
  @@ -106,10 +120,33 @@
   
   StylesheetExecutionContextDefault::~StylesheetExecutionContextDefault()
   {
  +	reset();
   }
   
   
   
  +void
  +StylesheetExecutionContextDefault::reset()
  +{
  +#if !defined(XALAN_NO_NAMESPACES)
  +	using std::for_each;
  +#endif
  +
  +	for_each(m_printWriters.begin(),
  +			 m_printWriters.end(),
  +			 DeleteFunctor<PrintWriter>());
  +
  +	m_printWriters.clear();
  +
  +	for_each(m_textOutputStreams.begin(),
  +			 m_textOutputStreams.end(),
  +			 DeleteFunctor<TextOutputStream>());
  +
  +	m_textOutputStreams.clear();
  +}
  +
  +
  +
   XObject*
   StylesheetExecutionContextDefault::getTopLevelVariable(const XalanDOMString&	theName) const
   {
  @@ -1012,6 +1049,59 @@
   	{
   		return m_stylesheetRoot->getDecimalFormatSymbols(name);
   	}
  +}
  +
  +
  +
  +PrintWriter*
  +StylesheetExecutionContextDefault::createPrintWriter(TextOutputStream*	theTextOutputStream)
  +{
  +	assert(theTextOutputStream != 0);
  +
  +	PrintWriter* const	thePrintWriter =
  +		new XercesDOMPrintWriter(*theTextOutputStream);
  +
  +	m_printWriters.insert(thePrintWriter);
  +
  +	return thePrintWriter;
  +}
  +
  +
  +
  +PrintWriter*
  +StylesheetExecutionContextDefault::createPrintWriter(
  +			const XalanDOMString&		theFileName,
  +			const XalanDOMString&		/* theEncoding */)
  +{
  +	// $$$ ToDo: We need to either remove these explicit dependencies on the
  +	// Xerces classes, or make the Xerces classes more generic. (I prefer the
  +	// latter...)
  +	TextOutputStream* const		theTextOutputStream =
  +		new TextFileOutputStream(theFileName);
  +
  +	m_textOutputStreams.insert(theTextOutputStream);
  +
  +	return createPrintWriter(theTextOutputStream);
  +}
  +
  +
  +
  +PrintWriter*
  +#if defined(XALAN_NO_NAMESPACES)
  +StylesheetExecutionContextDefault::createPrintWriter(ostream&	theStream)
  +#else
  +StylesheetExecutionContextDefault::createPrintWriter(std::ostream&	theStream)
  +#endif
  +{
  +	// $$$ ToDo: We need to either remove these explicit dependencies on the
  +	// Xerces classes, or make the Xerces classes more generic. (I prefer the
  +	// latter...)
  +	TextOutputStream* const		theTextOutputStream =
  +		new XercesStdTextOutputStream(theStream);
  +
  +	m_textOutputStreams.insert(theTextOutputStream);
  +
  +	return createPrintWriter(theTextOutputStream);
   }
   
   
  
  
  
  1.8       +28 -0     xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StylesheetExecutionContextDefault.hpp	2000/04/20 16:47:35	1.7
  +++ StylesheetExecutionContextDefault.hpp	2000/04/25 19:54:16	1.8
  @@ -65,6 +65,7 @@
   
   
   #include <memory>
  +#include <set>
   #include <vector>
   
   
  @@ -73,6 +74,7 @@
   
   
   
  +class TextOutputStream;
   class XPathProcessor;
   class XPathSupport;
   class XObjectFactory;
  @@ -101,6 +103,9 @@
   
   	// These interfaces are inherited from StylesheetExecutionContext...
   
  +	virtual void
  +	reset();
  +
   	virtual XObject*
   	getTopLevelVariable(const XalanDOMString&	theName) const;
   
  @@ -471,6 +476,21 @@
   	virtual const DecimalFormatSymbols*
   	getDecimalFormatSymbols(const XalanDOMString&	name);
   
  +	virtual PrintWriter*
  +	createPrintWriter(TextOutputStream*		theTextOutputStream);
  +
  +	virtual PrintWriter*
  +	createPrintWriter(
  +			const XalanDOMString&		theFileName,
  +			const XalanDOMString&		theEncoding);
  +
  +	virtual PrintWriter*
  +#if defined(XALAN_NO_NAMESPACES)
  +	createPrintWriter(ostream&			theStream);
  +#else
  +	createPrintWriter(std::ostream&		theStream);
  +#endif
  +
   	// These interfaces are inherited from ExecutionContext...
   
   	virtual void
  @@ -500,8 +520,12 @@
   
   #if defined(XALAN_NO_NAMESPACES)
   	typedef vector<const ElemTemplateElement*>			ElementRecursionStackType;
  +	typedef set<PrintWriter*>							PrintWriterSetType;
  +	typedef set<TextOutputStream*>						TextOutputStreamSetType;
   #else
   	typedef std::vector<const ElemTemplateElement*>		ElementRecursionStackType;
  +	typedef std::set<PrintWriter*>						PrintWriterSetType;
  +	typedef std::set<TextOutputStream*>					TextOutputStreamSetType;
   #endif
   
   	ElementRecursionStackType		m_elementRecursionStack;
  @@ -509,6 +533,10 @@
   	const PrefixResolver*			m_prefixResolver;
   
   	StylesheetRoot*					m_stylesheetRoot;
  +
  +	PrintWriterSetType				m_printWriters;
  +
  +	TextOutputStreamSetType			m_textOutputStreams;
   };
   
   
  
  
  
  1.11      +39 -59    xml-xalan/c/src/XSLT/StylesheetRoot.cpp
  
  Index: StylesheetRoot.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StylesheetRoot.cpp	2000/04/20 16:47:35	1.10
  +++ StylesheetRoot.cpp	2000/04/25 19:54:16	1.11
  @@ -81,8 +81,9 @@
   
   
   
  -#include <PlatformSupport/StringTokenizer.hpp>
   #include <PlatformSupport/AttributeListImpl.hpp>
  +#include <PlatformSupport/StringTokenizer.hpp>
  +#include <PlatformSupport/PrintWriter.hpp>
   
   
   
  @@ -99,11 +100,6 @@
   
   
   
  -#include <XercesPlatformSupport/XercesDOMPrintWriter.hpp>
  -#include <XercesPlatformSupport/XercesStdTextOutputStream.hpp>
  -
  -
  -
   #include "Constants.hpp"
   #include "ElemApplyTemplates.hpp" 
   #include "ElemTemplate.hpp" 
  @@ -143,27 +139,27 @@
   	m_defaultRule(0),
   	m_defaultRootRule(0)
   {
  -    // For some reason, the imports aren't working right if I 
  -    // don't set the baseIdent to full url.  I think this is OK, 
  -    // and probably safer and faster in general.
   #if !defined(XALAN_NO_NAMESPACES)
   	using std::auto_ptr;
   #endif
  -
  -	auto_ptr<XMLURL>	url(constructionContext.getURLFromString(m_baseIdent));
   
  -	if (url.get() != 0)
  +	if (length(baseIdentifier) != 0)
   	{
  -		m_baseIdent = url->getURLText();
  +		auto_ptr<XMLURL>	url(constructionContext.getURLFromString(m_baseIdent));
   
  -		auto_ptr<XMLURL>	url2(constructionContext.getURLFromString(m_baseIdent));
  -
  -		if (url2.get() != 0)
  +		if (url.get() != 0)
   		{
  -			m_importStack.push_back(url2.get());
  +			m_baseIdent = url->getURLText();
  +
  +			auto_ptr<XMLURL>	url2(constructionContext.getURLFromString(m_baseIdent));
  +
  +			if (url2.get() != 0)
  +			{
  +				m_importStack.push_back(url2.get());
   
  -			// Release the auto_ptr<>...
  -			url2.release();
  +				// Release the auto_ptr<>...
  +				url2.release();
  +			}
   		}
   	}
   }				
  @@ -207,9 +203,14 @@
   		executionContext.setStylesheetRoot(this);
   
   		FormatterListener* flistener = 0;
  -		bool newListener = false;
  +
  +#if !defined(XALAN_NO_NAMESPACES)
  +		using std::auto_ptr;
  +#endif
  +
  +		auto_ptr<FormatterListener>		theListenerGuard;
  +
   		Writer* pw = 0;
  -		bool newPW = false;
   
   		/*
   		 * Output target has a document handler
  @@ -254,30 +255,13 @@
   
   				if(0 != outputTarget.getByteStream())
   				{
  -					assert(0);	// @@ JMD: not supported yet ??
  -					// java: OutputStreamWriter osw = new OutputStreamWriter(outputTarget.getByteStream(), encoding);
  -					// java: pw = new PrintWriter( new BufferedWriter(osw) );
  +					pw = executionContext.createPrintWriter(*outputTarget.getByteStream());
   				}
  -				else if(! isEmpty(outputTarget.getFileName()))
  +				else if(!isEmpty(outputTarget.getFileName()))
   				{
  -					assert(0);	// @@ JMD: not supported yet ??
  -				/*
  -					FileOutputStream fos = new FileOutputStream(outputTarget.getFileName());
  -					try
  -					{
  -						// pw = new PrintWriter( new BufferedWriter(new FileWriter(outputTarget.getFileName())) );
  -						OutputStreamWriter osw = new OutputStreamWriter(fos, encoding);
  -						pw = new PrintWriter( new BufferedWriter(osw) );
  -					}
  -					catch(java.io.UnsupportedEncodingException uee)
  -					{
  -						mimeEncoding = "UTF-8";
  -						encoding = FormatterToXML.convertMime2JavaEncoding(mimeEncoding);
  -						OutputStreamWriter osw = new OutputStreamWriter(fos, encoding);
  -						pw = new PrintWriter( new BufferedWriter(osw) );
  -					}
  -					m_processor->setOutputFileName(outputTarget.getFileName());
  -				*/
  +					pw = executionContext.createPrintWriter(
  +								outputTarget.getFileName(),
  +								XalanDOMString());
   				}
   				else
   				{
  @@ -285,9 +269,7 @@
   					using std::cout;
   #endif
   
  -					// $$$ ToDo:  THIS IS A MEMORY LEAK!!!
  -					pw = new XercesDOMPrintWriter(*new XercesStdTextOutputStream(cout));
  -					newPW = true;
  +					pw = executionContext.createPrintWriter(cout);
   				}
   			}
   			
  @@ -304,21 +286,22 @@
   				flistener = new FormatterToHTML(
   					*pw, m_version, doIndent, indentAmount, m_encoding, m_mediatype,
   					m_doctypeSystem, m_doctypePublic, !m_omitxmlDecl, m_standalone);
  -				newListener = true;
   				break;
  +
   			case Formatter::OUTPUT_METH_TEXT:
   				flistener = new FormatterToText(*pw);
  -				newListener = true;
   				break;
  +
   			case Formatter::OUTPUT_METH_XML:
   			default:
   				flistener = new FormatterToXML(
   					*pw, m_version, doIndent, indentAmount, m_encoding, m_mediatype,
   					m_doctypeSystem, m_doctypePublic, !m_omitxmlDecl, m_standalone);
  -				newListener = true;
   				break;
   			}
   
  +			theListenerGuard = auto_ptr<FormatterListener>(flistener);
  +
   			executionContext.setFormatterListener(flistener);
   		}
   		/*
  @@ -331,26 +314,25 @@
   			case XalanNode::DOCUMENT_NODE:
   				flistener = new 
   					FormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
  -				newListener = true;
   				break;
   
   			case XalanNode::DOCUMENT_FRAGMENT_NODE:
   				flistener = new 
   					FormatterToDOM(executionContext.createDocument(),
   						static_cast<XalanDocumentFragment*>(outputTarget.getNode()));
  -				newListener = true;
   				break;
   
   			case XalanNode::ELEMENT_NODE:
   				flistener = new 
   					FormatterToDOM(executionContext.createDocument(),
   						static_cast<XalanElement*>(outputTarget.getNode()));
  -				newListener = true;
   				break;
   
   			default:
   				executionContext.error("Can only output to an Element, DocumentFragment, Document, or PrintWriter.");
   			}
  +
  +			theListenerGuard = auto_ptr<FormatterListener>(flistener);
   		}
   		/*
   		 * Create an empty document and set the output target node to this
  @@ -360,12 +342,13 @@
   			outputTarget.setNode(executionContext.createDocument());
   			flistener = new
   				FormatterToDOM(static_cast<XalanDocument*>(outputTarget.getNode()));
  -			newListener = true;
  +
  +			theListenerGuard = auto_ptr<FormatterListener>(flistener);
   		}
   		
   		executionContext.setFormatterListener(flistener);
   		executionContext.resetCurrentState(sourceTree, sourceTree);
  -		// @@ JMD: Is this OK ??
  +
   		executionContext.setRootDocument(static_cast<XalanDocument*>(sourceTree));
   		
   		if(executionContext.doDiagnosticsOutput())
  @@ -401,13 +384,10 @@
   
   		if(executionContext.doDiagnosticsOutput())
   		{
  +			executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
   			executionContext.displayDuration(XALAN_STATIC_UCODE_STRING("transform"), &sourceTree);
  +			executionContext.diag(XALAN_STATIC_UCODE_STRING(""));
   		}
  -		if (newListener) delete flistener;		
  -		// Can't release this until flistener is gone, since it contains a
  -		// reference to it
  -		if (newPW != 0) delete pw;
  -
   }
   
   
  
  
  
  1.29      +66 -55    xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XSLTEngineImpl.cpp	2000/04/20 16:47:35	1.28
  +++ XSLTEngineImpl.cpp	2000/04/25 19:54:17	1.29
  @@ -138,6 +138,7 @@
   #include "ProblemListener.hpp"
   #include "ProblemListenerDefault.hpp"
   #include "Stylesheet.hpp"
  +#include "StylesheetConstructionContext.hpp"
   #include "StylesheetExecutionContext.hpp"
   #include "StylesheetHandler.hpp"
   #include "StylesheetRoot.hpp"
  @@ -203,7 +204,6 @@
   	m_resultNameSpaces(),
   	m_emptyNamespace(),
   	m_xpathFactory(xpathFactory),
  -	m_xpath(xpathFactory.create()),
   	m_xobjectFactory(xobjectFactory),
   	m_xpathProcessor(new XPathProcessorImpl),
   	m_cdataStack(),
  @@ -264,7 +264,7 @@
   	m_XSLNameSpaceURL = s_DefaultXSLNameSpaceURL;
   	m_durationsTable.clear();
   	m_stylesheetLocatorStack.clear();
  -	m_pendingElementName = XalanDOMString();
  +	clear(m_pendingElementName);
   	m_pendingAttributes.clear();
   	m_cdataStack.clear();
   	m_resultTreeFactory = 0;
  @@ -275,14 +275,10 @@
   
   	m_stackGuard.clear();
   	m_xpathSupport.reset();
  -	m_parserLiaison.reset();
   	m_xpathEnvSupport.reset();
   	m_xpathFactory.reset();
   	m_xobjectFactory.reset();
   
  -	delete m_stylesheetRoot;
  -	m_stylesheetRoot = 0;
  -
   	m_stylesheetExecutionContext = 0;
   }
   
  @@ -549,8 +545,6 @@
     			XSLTInputSource&				stylesheetSource,
   			StylesheetConstructionContext&	constructionContext)
   {
  -	delete m_stylesheetRoot;
  -
   	const XalanDOMString	ds(XALAN_STATIC_UCODE_STRING("Input XSL"));
   	const XalanDOMString	xslIdentifier(0 == stylesheetSource.getSystemId() ? 
   									 ds : stylesheetSource.getSystemId());
  @@ -559,7 +553,7 @@
   	// try to parse the XML here.
   	try
   	{
  -		m_stylesheetRoot = new StylesheetRoot(stylesheetSource.getSystemId(), constructionContext);
  +		m_stylesheetRoot = constructionContext.create(stylesheetSource);
   
   		addTraceListenersToStylesheet();
   
  @@ -722,7 +716,7 @@
   	Stylesheet*			stylesheet = 0;
   
   	XalanDOMString			stringHolder;
  -	const XalanDOMString		localXSLURLString = clone(trim(xslURLString));
  +	const XalanDOMString	localXSLURLString = clone(trim(xslURLString));
   
   	const unsigned int	fragIndex = indexOf(localXSLURLString, '#');
   
  @@ -834,7 +828,7 @@
   
   			if(isRoot)
   			{
  -				m_stylesheetRoot = new StylesheetRoot(stringHolder, constructionContext);
  +				m_stylesheetRoot = constructionContext.create(stringHolder);
   				stylesheet = m_stylesheetRoot;
   			}
   			else
  @@ -871,13 +865,14 @@
   
   		if(isRoot)
   		{
  -			m_stylesheetRoot = new StylesheetRoot(localXSLURLString, constructionContext);
  +			m_stylesheetRoot = constructionContext.create(localXSLURLString);
   			stylesheet = m_stylesheetRoot;
   		}
   		else
   		{
   			stylesheet = new Stylesheet(*m_stylesheetRoot, localXSLURLString, constructionContext);
   		}
  +
   		addTraceListenersToStylesheet();
   
   		StylesheetHandler stylesheetProcessor(*this, *stylesheet, constructionContext);
  @@ -890,11 +885,9 @@
   
   		XSLTInputSource		inputSource(xslURL->getURLText());
   
  -		// java: m_parserLiaison.setDocumentHandler(stylesheetProcessor);
  -		//       m_parserLiaison.parse(inputSource);
   		m_parserLiaison.parseXMLStream(inputSource, stylesheetProcessor);
   
  -		displayDuration("Parsing and init of "+localXSLURLString, &localXSLURLString);
  +		displayDuration("Parsing and init of " + localXSLURLString, &localXSLURLString);
   	}
   
   	return stylesheet;
  @@ -1631,17 +1624,26 @@
   {
   	assert(m_flistener != 0);
   	assert(name != 0);
  +
   	flushPending();
  -	m_flistener->endElement(c_wstr(name));
  +
  +	m_flistener->endElement(name);
  +
   	if(m_traceListeners.size() > 0)
   	{
   		GenerateEvent ge(this, GenerateEvent::EVENTTYPE_ENDELEMENT, name, 0);
   		fireGenerateEvent(ge);
   	}
  +
   	m_resultNameSpaces.pop_back();
  -	Stylesheet::QNameVectorType cdataElems = m_stylesheetRoot->getCdataSectionElems();
  +
  +	const Stylesheet::QNameVectorType&	cdataElems =
  +		m_stylesheetRoot->getCdataSectionElems();
  +
   	if(0 != cdataElems.size())
  -      m_cdataStack.pop_back();
  +	{
  +		m_cdataStack.pop_back();
  +	}
   }
   
   
  @@ -1665,28 +1667,15 @@
   {
   	assert(m_flistener != 0);
   	assert(ch != 0);
  +
   	flushPending();
  -	Stylesheet::QNameVectorType cdataElems = m_stylesheetRoot->getCdataSectionElems();
  -	// java:
  -	//	if((null != m_stylesheetRoot.m_cdataSectionElems) && 
  -	//		!m_cdataStack.isEmpty() && (m_cdataStack.peek() == TRUE))
  +
  +	const Stylesheet::QNameVectorType&	cdataElems =
  +		m_stylesheetRoot->getCdataSectionElems();
   
   	if(0 != cdataElems.size() && 0 != m_cdataStack.size())
   	{
  -		//	java:	if(m_flistener instanceof FormatterListener)
  -		// @@ JMD: Need to add type member to DocumentHandler, etc ...
  -		// future: if (m_flistener.getType == eFormatterListener)
  -		if (true)		// @@ JMD: For now
  -		{
  -			FormatterListener* pfl =
  -				static_cast<FormatterListener*>(m_flistener);
  -			pfl->cdata(ch+start, length);
  -		}
  -		else
  -		{
  -			// Bad but I think it's better than dropping it.
  -			m_flistener->characters(ch, length);
  -		}
  +		m_flistener->cdata(ch + start, length);
   
   		if(m_traceListeners.size() > 0)
   		{
  @@ -1696,7 +1685,8 @@
   	}
   	else
   	{
  -		m_flistener->characters(ch+start, length);
  +		m_flistener->characters(ch + start, length);
  +
   		if(m_traceListeners.size() > 0)
   		{
   			GenerateEvent ge(this, GenerateEvent::EVENTTYPE_CHARACTERS, ch,
  @@ -2047,7 +2037,7 @@
   								  pfrag.get());
   
   	const XalanDOMString savedPendingName = m_pendingElementName;
  -	m_pendingElementName = XalanDOMString();
  +	clear(m_pendingElementName);
   
   	AttributeListImpl savedPendingAttributes(m_pendingAttributes);
   	m_pendingAttributes.clear();
  @@ -2385,15 +2375,18 @@
   			const XalanDOMString&	str,
   			XPathExecutionContext&	executionContext)
   {
  -    m_xpathProcessor->initXPath(*m_xpath,
  +	FactoryObjectAutoPointer<XPath>		theXPath(&m_xpathFactory,
  +												 m_xpathFactory.create());
  +
  +    m_xpathProcessor->initXPath(*theXPath.get(),
   								str,
   								*executionContext.getPrefixResolver(),
   								m_xobjectFactory,
   								m_xpathEnvSupport);
   
  -    return m_xpath->execute(executionContext.getCurrentNode(),
  -							*executionContext.getPrefixResolver(),
  -							executionContext);
  +    return theXPath->execute(executionContext.getCurrentNode(),
  +							 *executionContext.getPrefixResolver(),
  +							 executionContext);
   }
   
   
  @@ -2405,13 +2398,16 @@
   			const PrefixResolver&	prefixResolver,
   			XPathExecutionContext&	executionContext)
   {
  -    m_xpathProcessor->initXPath(*m_xpath,
  +	FactoryObjectAutoPointer<XPath>		theXPath(&m_xpathFactory,
  +												 m_xpathFactory.create());
  +
  +    m_xpathProcessor->initXPath(*theXPath.get(),
   								str,
   								prefixResolver,
   								m_xobjectFactory,
   								m_xpathEnvSupport);
   
  -    return m_xpath->execute(contextNode, prefixResolver, executionContext);
  +    return theXPath->execute(contextNode, prefixResolver, executionContext);
   }
   
   
  @@ -3993,6 +3989,7 @@
   XSLTEngineImpl::VariableStack::VariableStack(XSLTEngineImpl&	theProcessor) :
   	m_caller(),
   	m_stack(),
  +	m_stackEntries(),
   	m_processor(theProcessor),
   	m_globalStackFrameIndex(-1),
   	m_currentStackFrameIndex(0)
  @@ -4016,15 +4013,15 @@
   	using std::for_each;
   #endif
   
  -	// Delete all entries left on the stack
  -	// $$$ ToDo: Commented out because it's causing
  -	// problems.  Fix this!!!
  -//	for_each(m_stack.begin(),
  -//			 m_stack.end(),
  -//			 DeleteFunctor<StackEntry>());
  -
   	m_stack.clear();
   
  +	// Delete all entries that we created...
  +	for_each(m_stackEntries.begin(),
  +			 m_stackEntries.end(),
  +			 DeleteFunctor<StackEntry>());
  +
  +	m_stackEntries.clear();
  +
   	pushContextMarker(0, 0);	
   }
   
  @@ -4033,7 +4030,11 @@
   void
   XSLTEngineImpl::VariableStack::pushElementMarker(const XalanNode*	elem)
   {
  -	push(new ElementMarker(elem), true);
  +	StackEntry* const	theEntry = new ElementMarker(elem);
  +
  +	m_stackEntries.insert(theEntry);
  +
  +	push(theEntry);
   }
   
   
  @@ -4095,13 +4096,17 @@
   }
   
   
  -	
  +
   void
   XSLTEngineImpl::VariableStack::pushContextMarker(
   			const XalanNode*	caller,
   			const XalanNode*	sourceNode)
   {
  -	push(new ContextMarker(caller, sourceNode), true);
  +	StackEntry* const	theEntry = new ContextMarker(caller, sourceNode);
  +
  +	m_stackEntries.insert(theEntry);
  +
  +	push(theEntry);
   }
   
   
  @@ -4211,6 +4216,8 @@
   						}
   						assert(theArg != 0);
   
  +						m_stackEntries.insert(theArg);
  +
   						tempStack.push_back(theArg);
   					}
   
  @@ -4269,8 +4276,12 @@
   	{
   		pushElementMarker(e);
   	}
  +
  +	StackEntry* const	theEntry = new Arg(name, val, false);
  +
  +	m_stackEntries.insert(theEntry);
   
  -	push(new Arg(name, val, false), true);
  +	push(theEntry);
   }
   
   
  
  
  
  1.26      +36 -32    xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- XSLTEngineImpl.hpp	2000/04/20 16:47:35	1.25
  +++ XSLTEngineImpl.hpp	2000/04/25 19:54:18	1.26
  @@ -166,7 +166,6 @@
   	typedef XALAN_STD vector<const Locator*>	  LocatorStack;
   	typedef XALAN_STD vector<NameSpace> 		  NamespaceVectorType;
   	typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
  -	typedef XALAN_STD vector<StackEntry*>		  VariableStackStackType;
   	typedef XALAN_STD vector<TraceListener*>	  TraceListenerVectorType;
   	typedef XALAN_STD vector<bool>				  BoolVectorType;
   
  @@ -1653,7 +1652,8 @@
   		/**
   		 * Mark the top of the global stack frame.
   		 */
  -		void markGlobalStackFrame()
  +		void
  +		markGlobalStackFrame()
   		{
   			m_globalStackFrameIndex = m_stack.size();
   		}
  @@ -1665,7 +1665,8 @@
   		 *
   		 * @param currentStackFrameIndex new value of index
   		 */
  -		void setCurrentStackFrameIndex(int currentStackFrameIndex = -1)
  +		void
  +		setCurrentStackFrameIndex(int	currentStackFrameIndex = -1)
   		{
   			if (currentStackFrameIndex == -1)
   				m_currentStackFrameIndex = m_stack.size();
  @@ -1679,26 +1680,29 @@
   		 *
   		 * @return current value of index
   		 */
  -		int getCurrentStackFrameIndex() const
  +		int
  +		getCurrentStackFrameIndex() const
   		{
   			return m_currentStackFrameIndex;
   		}
   
   		/**
  -		 * Override the push in order to track the 
  -		 * m_currentStackFrameIndex correctly.
  +		 * Push an entry onto the stack.
   		 *
   		 * @param stack entry to push
  -		 * @param isNew true if object was created on the heap
   		 */
  -		void push(StackEntry* theEntry, bool isNew = false)
  +		void
  +		push(StackEntry*	theEntry)
   		{
  -			int type = theEntry->getType();
  -			assert(type <4 && type >= 0);
  +			assert(theEntry != 0);
  +			assert(theEntry->getType() < 4 && theEntry->getType() >= 0);
  +
   			if(m_currentStackFrameIndex == m_stack.size())
  -				m_currentStackFrameIndex+=1;
  +			{
  +				++m_currentStackFrameIndex;
  +			}
  +
   			m_stack.push_back(theEntry);
  -			m_isNew.push_back(isNew);
   		}
   
   		/**
  @@ -1707,22 +1711,19 @@
   		 *
   		 * @return stack entry popped
   		 */
  -		void pop()
  +		void
  +		pop()
   		{
  -			assert (! m_stack.empty());
  +			assert(m_stack.empty() == false);
  +
   			if(m_currentStackFrameIndex == m_stack.size())
  -				m_currentStackFrameIndex-=1;
  -			StackEntry* theEntry = m_stack.back();
  +			{
  +				--m_currentStackFrameIndex;
  +			}
  +
   			m_stack.pop_back();
  -			// @@ JMD: This should work, but seems to be causing problems ...
  -			/*
  -			if (m_isNew.back() == true)
  -				delete theEntry;
  -			*/
  -			m_isNew.pop_back();
   		}
   
  -
   	private:
   
   		XObject*
  @@ -1743,19 +1744,28 @@
   		const XalanElement* 			m_caller;
   
   
  +#if defined(XALAN_NO_NAMESPACES)
  +		typedef vector<StackEntry*>			VariableStackStackType;
  +		typedef set<StackEntry*>			StackEntrySetType;
  +#else
  +		typedef std::vector<StackEntry*>	VariableStackStackType;
  +		typedef std::set<StackEntry*>		StackEntrySetType;
  +#endif
  +
   		VariableStackStackType			m_stack;
  -		BoolVectorType	m_isNew;
  +
  +		StackEntrySetType				m_stackEntries;
   
   		XSLTEngineImpl&					m_processor;
   
  -		int m_globalStackFrameIndex;
  +		int								m_globalStackFrameIndex;
   
   		/**
   		 * This is the top of the stack frame from where a search 
   		 * for a variable or param should take place.  It may not 
   		 * be the real stack top.
   		 */
  -		unsigned int m_currentStackFrameIndex;
  +		unsigned int					m_currentStackFrameIndex;
   	
   	}; // end VariableStack
   
  @@ -2008,12 +2018,6 @@
   	
   	// Factory for creating xpaths.
   	XPathFactory&		m_xpathFactory;
  -
  -	/**
  -	 * XPath object to use for short evaluations, so we don't have to 
  -	 * create one every time.
  -	 */
  -	XPath* const		m_xpath;
   
   	// Factory for creating xobjects
   	XObjectFactory& 	m_xobjectFactory;
  
  
  
  1.5       +58 -21    xml-xalan/c/src/XSLT/XSLTInputSource.cpp
  
  Index: XSLTInputSource.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInputSource.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTInputSource.cpp	2000/04/11 15:09:31	1.4
  +++ XSLTInputSource.cpp	2000/04/25 19:54:18	1.5
  @@ -62,16 +62,23 @@
   
   
   
  +#include <cassert>
  +
  +
  +
   #include <framework/URLInputSource.hpp>
  +#include <util/BinFileInputStream.hpp>
   
   
   
  -#include <cassert>
  +#include <PlatformSupport/DOMStringHelper.hpp>
  +#include <PlatformSupport/StdBinInputStream.hpp>
   
   
   
   XSLTInputSource::XSLTInputSource() :
   	InputSource(""),
  +	m_stream(0),
   	m_node(0)
   {
   }
  @@ -81,6 +88,7 @@
   
   XSLTInputSource::XSLTInputSource(const XMLCh*	systemId) :
   	InputSource(systemId),
  +	m_stream(0),
   	m_node(0)
   {
   }
  @@ -91,6 +99,7 @@
   			const XMLCh*	systemId,
   			const XMLCh*	publicId) :
   	InputSource(systemId, publicId),
  +	m_stream(0),
   	m_node(0)
   {
   }
  @@ -99,6 +108,7 @@
   
   XSLTInputSource::XSLTInputSource(const char*	systemId) :
   	InputSource(systemId),
  +	m_stream(0),
   	m_node(0)
   {
   }
  @@ -110,39 +120,31 @@
   			const char*		publicId) :
   	InputSource(systemId,
   				publicId),
  +	m_stream(0),
   	m_node(0)
   {
   }
   
   
  -
  -XSLTInputSource::XSLTInputSource(InputStream*	/* byteStream */) :
  -	InputSource(""),
  -	m_node(0)
  -{
  -	// @@ JMD: These are not in the C++ InputSource class
  -	assert(0);	// @@ ??
  -	// java: setByteStream(byteStream);
  -}
  -
  -
   
  -XSLTInputSource::XSLTInputSource (Reader* /* characterStream */) :
  +XSLTInputSource::XSLTInputSource(XalanNode*		node) :
   	InputSource(""),
  -	m_node(0) 
  +	m_stream(0),
  +	m_node(node)
   {
  -	// @@ JMD: These are not in the C++ InputSource class
  -	assert(0);	// @@ ??
  -	// java: setCharacterStream(characterStream);
   }
   
   
   
  -XSLTInputSource::XSLTInputSource (XalanNode*	node) :
  +#if defined(XALAN_NO_NAMESPACES)
  +XSLTInputSource::XSLTInputSource(istream*		stream) :
  +#else
  +XSLTInputSource::XSLTInputSource(std::istream*	stream) :
  +#endif
   	InputSource(""),
  +	m_stream(stream),
   	m_node(0)
   {
  -	setNode(node);
   }
   
   
  @@ -150,10 +152,45 @@
   BinInputStream*
   XSLTInputSource::makeStream() const
   {
  -	URLInputSource inputSource(getSystemId());
  +	BinInputStream*		theResult = 0;
   
  +	if (m_stream != 0)
  +	{
  +		theResult = new StdBinInputStream(*m_stream);
  +	}
  +	else if (m_node == 0)
  +	{
  +		const XMLCh* const	theSystemID =
  +			getSystemId();
  +
  +		const unsigned int	theColonIndex = indexOf(theSystemID, ':');
  +		const unsigned int	theLength = length(theSystemID);
  +
  +		if (theColonIndex == theLength)
  +		{
  +			// No ':', so assume it's a file.
  +			theResult = new BinFileInputStream(theSystemID);
  +		}
  +		else
  +		{
  +			// It could be a DOS-style file spec...
  +			const unsigned int	theBackslashIndex = indexOf(theSystemID, '\\');
  +
  +			if (theBackslashIndex < theLength && theBackslashIndex == 3)
  +			{
  +				// OK, another shot at a file...
  +				theResult = new BinFileInputStream(theSystemID);
  +			}
  +			else
  +			{
  +				URLInputSource inputSource(getSystemId());
  +
  +				theResult = inputSource.makeStream();
  +			}
  +		}
  +	}
   
  -	return inputSource.makeStream();
  +	return theResult;
   }
   
   
  
  
  
  1.5       +24 -23    xml-xalan/c/src/XSLT/XSLTInputSource.hpp
  
  Index: XSLTInputSource.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTInputSource.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTInputSource.hpp	2000/04/11 15:09:31	1.4
  +++ XSLTInputSource.hpp	2000/04/25 19:54:19	1.5
  @@ -68,13 +68,15 @@
   
   
   
  +#include <iosfwd>
  +
  +
  +
   #include <sax/InputSource.hpp>
   
   
   
   class BinInputStream;
  -class InputStream;
  -class Reader;
   class XalanNode;
   
   
  @@ -138,37 +140,30 @@
   			const XMLCh*	publicId);
   
   	/**
  -	 * Create a new input source with a byte stream.
  -	 *
  -	 * <p>Application writers may use setSystemId to provide a base for
  -	 * resolving relative URIs, setPublicId to include a public identifier,
  -	 * and/or setEncoding to specify the object's character encoding.</p>
  -	 *
  -	 * @param byteStream pointer to raw byte stream containing the document
  -	 */
  -	XSLTInputSource(InputStream*	byteStream);
  -
  -	/**
  -	 * Create a new input source with a character stream.
  +	 * Create a new input source with a DOM node.
   	 *
  -	 * <p>Application writers may use setSystemId() to provide a base 
  -	 * for resolving relative URIs, and setPublicId to include a 
  -	 * public identifier.</p>
  +	 * <p>Application writers may use setSystemId() to provide a base for
  +	 * resolving relative URIs, and setPublicId to include a public
  +	 * identifier.</p>
   	 *
  -	 * @param characterStream pointer to character stream containing the document
  +	 * @param node DOM node that is root of the document
   	 */
  -	XSLTInputSource(Reader*		characterStream);
  +	XSLTInputSource(XalanNode*	node);
   
   	/**
  -	 * Create a new input source with a DOM node.
  +	 * Create a new input source with std stream.
   	 *
   	 * <p>Application writers may use setSystemId() to provide a base for
   	 * resolving relative URIs, and setPublicId to include a public
   	 * identifier.</p>
   	 *
  -	 * @param node DOM node that is root of the document
  +	 * @param stream the input stream...
   	 */
  -	XSLTInputSource(XalanNode*	node);
  +#if defined(XALAN_NO_NAMESPACES)
  +	XSLTInputSource(istream*		stream);
  +#else
  +	XSLTInputSource(std::istream*	stream);
  +#endif
   
   	/**
   	 * Makes the byte stream for this input source.
  @@ -200,8 +195,14 @@
   	getNode() const;
   
   private:
  +
  +#if defined(XALAN_NO_NAMESPACES)
  +	istream*		m_stream;
  +#else
  +	std::istream*	m_stream;
  +#endif
   
  -	XalanNode*	m_node;
  +	XalanNode*		m_node;
   };
   
   
  
  
  
  1.4       +7 -3      xml-xalan/c/src/XSLT/XSLTResultTarget.cpp
  
  Index: XSLTResultTarget.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTResultTarget.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSLTResultTarget.cpp	2000/04/11 15:09:31	1.3
  +++ XSLTResultTarget.cpp	2000/04/25 19:54:20	1.4
  @@ -91,15 +91,19 @@
   
   
   
  -XSLTResultTarget::XSLTResultTarget(OutputStream*	byteStream) :
  +#if defined(XALAN_NO_NAMESPACES)
  +XSLTResultTarget::XSLTResultTarget(ostream*		theStream) :
  +#else
  +XSLTResultTarget::XSLTResultTarget(std::ostream*	theStream) :
  +#endif
   	m_fileName(),
  -	m_byteStream(byteStream),
  +	m_byteStream(theStream),
   	m_encoding(),
   	m_characterStream(0),
   	m_node(),
   	m_formatterListener(0)
   {
  -	assert(byteStream != 0);
  +	assert(theStream != 0);
   }
   
   
  
  
  
  1.5       +29 -8     xml-xalan/c/src/XSLT/XSLTResultTarget.hpp
  
  Index: XSLTResultTarget.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTResultTarget.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTResultTarget.hpp	2000/04/11 15:09:31	1.4
  +++ XSLTResultTarget.hpp	2000/04/25 19:54:20	1.5
  @@ -66,12 +66,18 @@
   
   
   
  +#include <iosfwd>
  +
  +
  +
   #include <XalanDOM/XalanDOMString.hpp>
  +
  +
  +
   #include <XMLSupport/FormatterListener.hpp>
   
   
   
  -class OutputStream;
   class XalanNode;
   class Writer;
   
  @@ -92,12 +98,15 @@
   	XSLTResultTarget(const XalanDOMString&	fileName);
   
   	/**
  -	 * Create a new output target with a byte stream.
  +	 * Create a new output target with a stream.
   	 *
  -	 * @param byteStream pointer to raw byte stream that will contain the
  -	 *                   document
  +	 * @param byteStream a pointer to a std ostream for the output
   	 */
  -	XSLTResultTarget(OutputStream*		byteStream);
  +#if defined(XALAN_NO_NAMESPACES)
  +	XSLTResultTarget(ostream*		theStream);
  +#else
  +	XSLTResultTarget(std::ostream*	theStream);
  +#endif
   
   	/**
   	 * Create a new output target with a character stream.
  @@ -143,7 +152,11 @@
   	 *                   document
   	 */
   	void
  -	setByteStream(OutputStream*		byteStream)
  +#if defined(XALAN_NO_NAMESPACES)
  +	setByteStream(ostream*			byteStream)
  +#else
  +	setByteStream(std::ostream*		byteStream)
  +#endif
   	{
   		m_byteStream = byteStream;
   	}
  @@ -153,7 +166,11 @@
   	 *
   	 * @return pointer to byte stream, or null if none was supplied.
   	 */
  -	OutputStream*
  +#if defined(XALAN_NO_NAMESPACES)
  +	ostream*
  +#else
  +	std::ostream*
  +#endif
   	getByteStream() const
   	{
   		return m_byteStream;
  @@ -274,7 +291,11 @@
   
   	XalanDOMString		m_fileName;
   
  -	OutputStream*		m_byteStream;
  +#if defined(XALAN_NO_NAMESPACES)
  +	ostream*			m_byteStream;
  +#else
  +	std::ostream*		m_byteStream;
  +#endif
   
   	XalanDOMString		m_encoding;