You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by pa...@locus.apache.org on 2000/11/16 16:19:46 UTC

cvs commit: xml-xalan/c/Tests/Harness XMLFileReporter.hpp XMLFileReporter.cpp Harness.dsw Harness.dsp

pauldick    00/11/16 07:19:45

  Added:       c/Tests/Harness XMLFileReporter.hpp XMLFileReporter.cpp
                        Harness.dsw Harness.dsp
  Log:
  Harness code used by tests to output results in a manner
  similar to Java harness
  
  Revision  Changes    Path
  1.1                  xml-xalan/c/Tests/Harness/XMLFileReporter.hpp
  
  Index: XMLFileReporter.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * XMLFileReporter.java
   */
  #if !defined(HARNESS_HEADER_GUARD_1357924680)
  #define HARNESS_HEADER_GUARD_1357924680
  
  
  #include<string>
  #include<stdio.h>
  #include <time.h>
  
  
  
  using namespace std;
  
  
  
  /**
   * Reporter that saves output to a simple XML-format file.  
   * @author Shane_Curcuru@lotus.com
   * @version $Id: XMLFileReporter.hpp,v 1.1 2000/11/16 15:19:45 pauldick Exp $
   */
  
  #if defined HARNESS_EXPORTS
  #define HARNESS_API __declspec(dllexport)
  #else
  #define HARNESS_API __declspec(dllimport)
  #endif
  
  // This class is exported from the Harness.dll
  class HARNESS_API XMLFileReporter 
  {
  
  
  public:
  
  	/** Simple constructor, does not perform initialization.  */
  	XMLFileReporter();   
  
  
  	/** Construct and initialize this reporter with specified filename.  */
  	XMLFileReporter(const string& fileName);
  
  	/** Initialize this XMLFileReporter.  Must be called before attempting to log anything.  */
  	bool initialize();
  
  	/** Accessor for flushing; is set from properties.  */
  	bool getFlushOnCaseClose();
  
  	/** Accessor methods for our properties block.  */
  	const string& getFileName() const;
  
  	/** Accessor methods for our properties block.  */
  	void setFileName(const string& fileName);
  
  	/**
  	* Is this Reporter still running OK?  
  	* @returns status - true if an error has occoured, false if it's still working fine
  	* <P>XMLFileReporter should just about never have errors.</P>
  	*/
  	bool checkError();
  
  
  	/**
  	* Is this Reporter ready to log results?  
  	* @returns status - true if it's ready to report, false otherwise
  	*/
  	bool isReady();
  
  	/** Flush this reporter - ensure our File is flushed.  */
  	void flush();
  
  
  	/** Close this reporter - ensure our File, etc. are closed.  */
  	void close();
  
  	//-----------------------------------------------------
  	//-------- Testfile / Testcase start and stop routines --------
  	//-----------------------------------------------------
  
  	/**
  	* Report that a testfile has started.  
  	* @param msg message to log out
  	*/
  	void logTestFileInit(const string& msg);
  
  	/**
  	* Report that a testfile has finished, and report it's result.  
  	* @param msg message to log out
  	* @param result result of testfile
  	*/
  	void logTestFileClose(const string& msg, const string& result);
  
  	void logTestCaseInit(const string& msg);
  
  	/**
  	* Report that a testcase has finished, and report it's result.  
  	* @param msg message to log out
  	* @param result result of testfile
  	*/
  	void logTestCaseClose(const string& msg, const string& result);
  
  	//-----------------------------------------------------
  	//-------- Test results reporting and logging routines --------
  	//-----------------------------------------------------
  
  
  	/**
  	* Report a comment to result file with specified severity.  
  	* <P>Record format: &lt;message level="##"&gt;msg&lt;/message&gt;</P>
  	* @param level severity or class of message.
  	* @param msg comment to log out.
  	*/
  	void logMessage(int level, const string& msg);
  
  	/**
  	* Logs out statistics to result file with specified severity.  
  	* <P>Record format: &lt;statistic level="##" desc="msg"&gt;&lt;longval&gt;1234&lt;/longval&gt;&lt;doubleval&gt;1.234&lt;/doubleval&gt;&lt;/statistic&gt;</P>
  	* @param level severity of message.
  	* @param lVal statistic in long format.
  	* @param dVal statistic in double format.
  	* @param msg comment to log out.
  	*/
  	void logStatistic (int level, long lVal, double dVal, const string& msg);
  
  	/**
  	* Report an arbitrary string to result file with specified severity.  
  	* <P>Appends and prepends \\n newline characters at the start and 
  	* end of the message to separate it from the tags.</P>
  	* <P>Record format: &lt;arbitrary level="##"&gt;<BR/>
  	* msg<BR/>
  	* &lt;/arbitrary&gt;
  	* </P>
  	* @param level severity or class of message.
  	* @param msg arbitrary string to log out.
  	*/
  	void logArbitraryMessage (int level, const string& msg);
  
  	/**
  	* Report a complete Hashtable to result file with specified severity.  
  	* <P>Indents each hashitem within the table.</P>
  	* <P>Record format: &lt;hashtable level="##" desc="msg"/&gt;<BR/>
  	* &nbsp;&nbsp;&lt;hashitem key="key1"&gt;value1&lt;/hashitem&gt;<BR/>
  	* &nbsp;&nbsp;&lt;hashitem key="key2"&gt;value2&lt;/hashitem&gt;<BR/>
  	* &lt;/hashtable&gt;
  	* </P>
  	* @param level severity or class of message.
  	* @param hash Hashtable to log the contents of. 
  	* @param msg decription of the Hashtable.
  	*/
  	/*
  	void logHashtable (int level, Hashtable hash, const string& msg);
  	*/
  
  	/**
  	* Writes out a Pass record with comment.  
  	* <P>Record format: &lt;checkresult result="PASS" desc="comment"/&gt;</P>
  	* @param comment comment to log with the pass record.
  	*/
  	void logCheckPass(const string& comment);
  
  	/**
  	* Writes out an ambiguous record with comment.  
  	* <P>Record format: &lt;checkresult result="AMBG" desc="comment"/&gt;</P>
  	* @param comment comment to log with the ambg record.
  	*/
  	void logCheckAmbiguous(const string& comment);
  
  	/**
  	* Writes out a Fail record with comment.  
  	* <P>Record format: &lt;checkresult result="FAIL" desc="comment"/&gt;</P>
  	* @param comment comment to log with the fail record.
  	*/
  	void logCheckFail(const string& comment);
  
  	/**
  	* Writes out a Error record with comment.  
  	* <P>Record format: &lt;checkresult result="ERRR" desc="comment"/&gt;</P>
  	* @param comment comment to log with the error record.
  	*/
  	void logCheckErr(const string& comment);
  
  	/**
  	* Escapes a string to remove < and > so it's valid XML.  
  	* <P>Stolen mostly from Xalan applet sample.</P>
  	* @param s string to escape.
  	* @return string that has been escaped.
  	*/
  	string escapestring(const string& s);
  
  private:
  
  	/**
  	* worker method to dump the xml header and open the resultsfile element.  
  	*/
  	bool startResultsFile();
  
  	/**
  	* worker method to close the resultsfile element.  
  	*/
  	bool closeResultsFile();
  
  	/**
  	* worker method to prints to the resultsfile.  
  	*/
  	bool printToFile(const string& output);
  
  	/**
  	* worker method to prints to the resultsfile.  
  	*/
  	string getDateTimeString();
  	
  	/** Key for Properties block that denotes our output filename.  */
  	static const string OPT_FILENAME;
  
  	/** XML tagnames for results file structure.  */
  	static const string ELEM_RESULTSFILE;
  	static const string ELEM_TESTFILE;
  	static const string ELEM_FILERESULT;
  	static const string ELEM_TESTCASE;
  	static const string ELEM_CASERESULT;
  	static const string ELEM_CHECKRESULT;
  	static const string ELEM_STATISTIC;
  	static const string ELEM_LONGVAL;
  	static const string ELEM_DOUBLEVAL;
  	static const string ELEM_MESSAGE;
  	static const string ELEM_ARBITRARY;
  	static const string ELEM_HASHTABLE;
  	static const string ELEM_HASHITEM;
  
  	/** XML attribute names for results file structure.  */
  	static const string ATTR_LEVEL;
  	static const string ATTR_DESC;
  	static const string ATTR_TIME;
  	static const string ATTR_RESULT;
  	static const string ATTR_KEY;
  	static const string ATTR_FILENAME;
  
  	/** 
  	* Optimization: for heavy use methods, form pre-defined constants to save on string concatenation.  
  	* <P>Note the indent; must be updated if we ever switch to another indenting method.</P>
  	*/
  	static const string TESTCASEINIT_HDR;
  	static const string TESTCASECLOSE_HDR;
  	static const string MESSAGE_HDR;
  	static const string STATISTIC_HDR;
  	static const string ARBITRARY_HDR;
  	static const string HASHTABLE_HDR;
  	static const string HASHITEM_HDR;
  	static const string CHECKPASS_HDR;
  	static const string CHECKAMBG_HDR;
  	static const string CHECKERRR_HDR;
  	static const string CHECKFAIL_HDR;
  
  	/** If we have output anything yet.  */
  	bool m_anyOutput;
  
  	/** Name of the file we're outputing to.  */
  	string m_fileName;
  
  	/** File reference and other internal convenience variables.  */
  	FILE* m_fileHandle;
  
  	/** If we're ready to start outputting yet.  */
  	bool m_ready;
  
  	/** If an error has occoured in this Reporter.  */
  	bool m_error;
  
  	/** If we should flush after every logTestCaseClose.  */
  	bool m_flushOnCaseClose;
  
  };        // end of class XMLFileReporter
  #endif
  
  
  1.1                  xml-xalan/c/Tests/Harness/XMLFileReporter.cpp
  
  Index: XMLFileReporter.cpp
  ===================================================================
  /*
  *
  * XMLFileReporter.cpp
  *
  * Copyright 2000 Lotus Development Corporation. All rights reserved.
  * This software is subject to the Lotus Software Agreement, Restricted
  * Rights for U.S. government users and applicable export regulations.
  */
  #include "XMLFileReporter.hpp" 
  
  
  const string const XMLFileReporter::OPT_FILENAME = "filename";
  
  const string const XMLFileReporter::ELEM_RESULTSFILE = "resultsfile";
  const string const XMLFileReporter::ELEM_TESTFILE = "testfile";
  const string const XMLFileReporter::ELEM_FILERESULT = "fileresult";
  const string const XMLFileReporter::ELEM_TESTCASE = "testcase";
  const string const XMLFileReporter::ELEM_CASERESULT = "caseresult";
  const string const XMLFileReporter::ELEM_CHECKRESULT = "checkresult";
  const string const XMLFileReporter::ELEM_STATISTIC = "statistic";
  const string const XMLFileReporter::ELEM_LONGVAL = "longval";
  const string const XMLFileReporter::ELEM_DOUBLEVAL = "doubleval";
  const string const XMLFileReporter::ELEM_MESSAGE = "message";
  const string const XMLFileReporter::ELEM_ARBITRARY = "arbitrary";
  const string const XMLFileReporter::ELEM_HASHTABLE = "hashtable";
  const string const XMLFileReporter::ELEM_HASHITEM = "hashitem";
  
  const string const XMLFileReporter::ATTR_LEVEL = "level";
  const string const XMLFileReporter::ATTR_DESC = "desc";
  const string const XMLFileReporter::ATTR_TIME = "time";
  const string const XMLFileReporter::ATTR_RESULT = "result";
  const string const XMLFileReporter::ATTR_KEY = "key";
  const string const XMLFileReporter::ATTR_FILENAME = XMLFileReporter::OPT_FILENAME;
  
  const string XMLFileReporter::TESTCASEINIT_HDR = "<" + ELEM_TESTCASE + " " + ATTR_DESC + "=\"";
  const string XMLFileReporter::TESTCASECLOSE_HDR = "<" + ELEM_CASERESULT + " " + ATTR_DESC + "=\"";
  const string XMLFileReporter::MESSAGE_HDR = "<" + ELEM_MESSAGE + " " + ATTR_LEVEL + "=\"";
  const string XMLFileReporter::STATISTIC_HDR = "<" + ELEM_STATISTIC + " " + ATTR_LEVEL + "=\"";
  const string XMLFileReporter::ARBITRARY_HDR = "<" + ELEM_ARBITRARY + " " + ATTR_LEVEL + "=\"";
  const string XMLFileReporter::HASHTABLE_HDR = "<" + ELEM_HASHTABLE + " " + ATTR_LEVEL + "=\"";
  const string XMLFileReporter::HASHITEM_HDR = "  <" + ELEM_HASHITEM + " " + ATTR_KEY + "=\"";
  const string XMLFileReporter::CHECKPASS_HDR = "<" + ELEM_CHECKRESULT + " " + ATTR_RESULT + "=\"" + "PASS" + "\" " + ATTR_DESC + "=\"";
  const string XMLFileReporter::CHECKAMBG_HDR = "<" + ELEM_CHECKRESULT + " " + ATTR_RESULT + "=\"" + "AMBG" + "\" " + ATTR_DESC + "=\"";
  const string XMLFileReporter::CHECKERRR_HDR = "<" + ELEM_CHECKRESULT + " " + ATTR_RESULT + "=\"" + "ERRR" + "\" " + ATTR_DESC + "=\"";
  const string XMLFileReporter::CHECKFAIL_HDR = "<" + ELEM_CHECKRESULT + " " + ATTR_RESULT + "=\"" + "FAIL" + "\" " + ATTR_DESC + "=\"";
  
  
  
  XMLFileReporter::XMLFileReporter():
  	m_anyOutput(false),
  	m_fileName(""),
  	m_fileHandle(0),
  	m_ready(false),
  	m_error(false),
  	m_flushOnCaseClose(true)
  {        
  }
  
  
  
  XMLFileReporter::XMLFileReporter(const string& fileName):
  	m_anyOutput(false),
  	m_fileName(fileName),
  	m_fileHandle(0),
  	m_ready(false),
  	m_error(false),
  	m_flushOnCaseClose(true)
  {         
      m_ready = initialize();
  }
  
  
  
  bool 
  XMLFileReporter::initialize()
  {   	
      if (m_fileName.length == 0)
      {
          // We don't have a valid file, so bail
          m_error = true;
          m_ready = false;
          fprintf(stderr, "XMLFileReporter.initialize() ERROR: file name is blank");
          return(false);
      }
  
      // Create a file and ensure it has a place to live
  	m_fileHandle = fopen(m_fileName.c_str(), "w");
  	if (m_fileHandle == 0)
  	{
          // Couldn't create or find the directory for the file to live in, so bail
          m_error = true;
          m_ready = false;
          fprintf(stderr, "XMLFileReporter.initialize() ERROR: unble to open file, %s", m_fileName);
          return(false);
  	}	        
      
      m_ready = true;
      startResultsFile();
      // fprintf(stderr, "DEBUG:XMLFileReporter.initialize() complete with " + fileName);
  
      return m_ready;
  }
  
  
  
  bool
  XMLFileReporter::getFlushOnCaseClose()
  {
      return(m_flushOnCaseClose);
  }
  
  
  
  const string& 
  XMLFileReporter::getFileName() const
  {
      return(m_fileName);
  }
  
  
  
  void 
  XMLFileReporter::setFileName(const string& fileName)
  {
  	m_fileName = fileName;
  }
  
  
  
  bool 
  XMLFileReporter::checkError()
  {
      // Ensure our underlying reporter, if one, is still OK
      if (m_fileHandle == 0)            
      {            
          m_error = true;        
      }
      return(m_error);
  }
  
  
  
  bool 
  XMLFileReporter::isReady() 
  {
      // Ensure our underlying reporter, if one, is still OK
      if (m_fileHandle == 0) 
      {
          // NEEDSWORK: should we set m_ready = false in this case?
          //            errors in the PrintStream are not necessarily fatal
          m_error = true;
          m_ready = false;
      }
      return(m_ready);
  }
  
  
  
  void 
  XMLFileReporter::flush()
  {
      if (isReady())
      {
  		fflush(m_fileHandle);
      }
  }
  
  
  
  void 
  XMLFileReporter::close()
  {
      fflush(m_fileHandle);
      if (isReady()) 
      {
  		if (m_fileHandle != 0)
  		{
  			closeResultsFile();
  			fclose(m_fileHandle);
  		}
      }
      m_ready = false;
  }
  
  
  
  void 
  XMLFileReporter::logTestFileInit(const string& msg)
  {
      if (isReady())
      {
          printToFile("<" + ELEM_TESTFILE 
                                + " " + ATTR_DESC + "=\"" + escapestring(msg) + "\" " + ATTR_TIME + "=\"" + getDateTimeString() + "\">");
      }
  }
  
  
  
  void 
  XMLFileReporter::logTestFileClose(const string& msg, const string& result)
  {
      if (isReady())
      {
          printToFile("<" + ELEM_FILERESULT 
                                + " " + ATTR_DESC + "=\"" + escapestring(msg) + "\" " + ATTR_RESULT + "=\"" + result + "\" " + ATTR_TIME + "=\"" + getDateTimeString() + "\"/>");
          printToFile("</" + ELEM_TESTFILE + ">");
      }
      flush();
  }
  
  
  
  void 
  XMLFileReporter::logTestCaseInit(const string& msg)
  {
      if (isReady())
      {
          printToFile(TESTCASEINIT_HDR + escapestring(msg) + "\">");
      }
  }
  
  
  
  void 
  XMLFileReporter::logTestCaseClose(const string& msg, const string& result)
  {
      if (isReady())
      {
          printToFile(TESTCASECLOSE_HDR + escapestring(msg) + "\" " + ATTR_RESULT + "=\"" + result + "\"/>");
          printToFile("</" + ELEM_TESTCASE + ">");
      }
      if (getFlushOnCaseClose())
      {
          flush();
      }
  }
  
  
  
  void 
  XMLFileReporter::logMessage(int level, const string& msg)
  {
      if (isReady())
      {
          printToFile(MESSAGE_HDR + (char)level + "\">");
          printToFile(escapestring(msg));
          printToFile("</" + ELEM_MESSAGE +">");
      }
  }
  
  
  
  void 
  XMLFileReporter::logStatistic (int level, long lVal, double dVal, const string& msg)
  {
      if (isReady())
      {
          //printToFile(STATISTIC_HDR + level + "\" " + ATTR_DESC + "=\"" + escapestring(msg) + "\">");
          fprintf(m_fileHandle, "%s%d%s%s%s%s", STATISTIC_HDR, level, "\" ", ATTR_DESC, "=\"", escapestring(msg), "\">\n");
  		//printToFile("<" + ELEM_LONGVAL + ">" + lVal + "</" + ELEM_LONGVAL + ">");
  		fprintf(m_fileHandle, "%s%s%d%s%s", "<", ELEM_LONGVAL, ">", lVal, "</", ELEM_LONGVAL, ">\n");
          //printToFile("<" + ELEM_DOUBLEVAL + ">" + dVal + "</" + ELEM_DOUBLEVAL + ">");
  		fprintf(m_fileHandle, "%s%s%d%s%s", "<", ELEM_DOUBLEVAL, ">", dVal, "</", ELEM_DOUBLEVAL + ">\n");
          printToFile("</" + ELEM_STATISTIC + ">");
  		
      }
  }
  
  
  
  void 
  XMLFileReporter::logArbitraryMessage (int level, const string& msg)
  {
      if (isReady())
      {            
  		fprintf(m_fileHandle, "%s%d%s", ARBITRARY_HDR, level, "\">\n");
          printToFile(escapestring(msg));
          printToFile("</" + ELEM_ARBITRARY +">");
      }
  }
  
  
  
  /*
  void logHashtable (int level, Hashtable hash, string msg)
  {
      if (isReady())
      {
          printToFile(HASHTABLE_HDR + level + "\" " + ATTR_DESC + "=\"" + msg + "\">");
          if (hash == null)
          {
              printToFile("<" + ELEM_HASHITEM + " " + ATTR_KEY + "=\"null\">");
              printToFile("</" + ELEM_HASHITEM + ">");
          }
          try
          {
              for (Enumeration enum = hash.keys(); enum.hasMoreElements();)
              {
                  Object key = enum.nextElement();
                  // Ensure we'll have clean output by pre-fetching value before outputting anything
                  string value = hash.get(key).tostring();
                  printToFile(HASHITEM_HDR + key.tostring() + "\">");
                  printToFile(value);
                  printToFile("</" + ELEM_HASHITEM + ">");
              }
          } 
          catch (Exception e)
          {
              // No-op: should ensure we have clean output
          }
          printToFile("</" + ELEM_HASHTABLE +">");
      }
  }
  */
  
  
  
  void 
  XMLFileReporter::logCheckPass(const string& comment)
  {
      if (isReady())
      {
          printToFile(CHECKPASS_HDR + escapestring(comment) + "\"/>");
      }
  }
  
  
  
  void 
  XMLFileReporter::logCheckAmbiguous(const string& comment)
  {
      if (isReady())
      {
          printToFile(CHECKAMBG_HDR + escapestring(comment) + "\"/>");
      }
  }
  
  
  
  void 
  XMLFileReporter::logCheckFail(const string& comment)
  {
      if (isReady())
      {
          printToFile(CHECKFAIL_HDR + escapestring(comment) + "\"/>");
      }
  }
  
  
  
  void 
  XMLFileReporter::logCheckErr(const string& comment)
  {
      if (isReady())
      {
          printToFile(CHECKERRR_HDR + escapestring(comment) + "\"/>");
      }
  }
  
  
  
  string 
  XMLFileReporter::escapestring(const string&  s)
  {
      string sb;
      const int length = s.length();
  
      for (int i = 0; i < length; i++)
      {
          char ch = s.at(i);
          if ('<' == ch)
          {
              sb.append("&lt;");
          }
          else if ('>' == ch)
          {
              sb.append("&gt;");
          }
          // Note: Skipping escaping of UTF-16 surrogates and & ampersands, since 
          //  I don't think we'll be outputting them or they won't affect our output
          else
          {
              sb += ch;
          }
      }
      return sb;
  }
  
  
  
  bool 
  XMLFileReporter::startResultsFile()
  {
      if (isReady())
      {
          // Write out XML header and root test result element
          printToFile("<?xml version=\"1.0\"?>");
          // Note: this tag is closed in our .close() method, which the caller had better call!
          printToFile("<" + ELEM_RESULTSFILE + " " + ATTR_FILENAME + "=\"" + m_fileName + "\">");
          return true;
      }
      else
          return false;
  }
  
  
  
  bool 
  XMLFileReporter::closeResultsFile()
  {
      if (isReady())
      {            
  		printToFile("</" + ELEM_RESULTSFILE + ">");
          return true;
      }
      else
          return false;
  }
  
  
  bool 
  XMLFileReporter::printToFile(const string& output) 
  {
      if (isReady())
      {
          fprintf(m_fileHandle, output.c_str());
  		fprintf(m_fileHandle, "\n");
          return true;
      }
      else
          return false;
  }
  
  
  
  string 
  XMLFileReporter::getDateTimeString() 
  {
  	struct tm *tmNow;
  	time_t time_tNow;
  	string dateTimeString;
  
  	time(&time_tNow);     
  	tmNow = localtime(&time_tNow);  							
  	dateTimeString = asctime(tmNow); 
  	dateTimeString.replace(dateTimeString.length()-1, 1, "");
  
  	return dateTimeString;       
  }
  
  
  
  1.1                  xml-xalan/c/Tests/Harness/Harness.dsw
  
  Index: Harness.dsw
  ===================================================================
  Microsoft Developer Studio Workspace File, Format Version 6.00
  # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
  
  ###############################################################################
  
  Project: "Harness"=".\Harness.dsp" - Package Owner=<4>
  
  Package=<5>
  {{{
  }}}
  
  Package=<4>
  {{{
  }}}
  
  ###############################################################################
  
  Global:
  
  Package=<5>
  {{{
  }}}
  
  Package=<3>
  {{{
  }}}
  
  ###############################################################################
  
  
  
  
  1.1                  xml-xalan/c/Tests/Harness/Harness.dsp
  
  Index: Harness.dsp
  ===================================================================
  # Microsoft Developer Studio Project File - Name="Harness" - Package Owner=<4>
  # Microsoft Developer Studio Generated Build File, Format Version 6.00
  # ** DO NOT EDIT **
  
  # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
  
  CFG=Harness - Win32 Debug
  !MESSAGE This is not a valid makefile. To build this project using NMAKE,
  !MESSAGE use the Export Makefile command and run
  !MESSAGE 
  !MESSAGE NMAKE /f "Harness.mak".
  !MESSAGE 
  !MESSAGE You can specify a configuration when running NMAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE 
  !MESSAGE NMAKE /f "Harness.mak" CFG="Harness - Win32 Debug"
  !MESSAGE 
  !MESSAGE Possible choices for configuration are:
  !MESSAGE 
  !MESSAGE "Harness - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
  !MESSAGE "Harness - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
  !MESSAGE 
  
  # Begin Project
  # PROP AllowPerConfigDependencies 0
  # PROP Scc_ProjName ""
  # PROP Scc_LocalPath ""
  CPP=cl.exe
  MTL=midl.exe
  RSC=rc.exe
  
  !IF  "$(CFG)" == "Harness - Win32 Release"
  
  # PROP BASE Use_MFC 0
  # PROP BASE Use_Debug_Libraries 0
  # PROP BASE Output_Dir "Release"
  # PROP BASE Intermediate_Dir "Release"
  # PROP BASE Target_Dir ""
  # PROP Use_MFC 0
  # PROP Use_Debug_Libraries 0
  # PROP Output_Dir "..\..\Build\Win32\VC6\Release"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Release\Performance"
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HARNESS_EXPORTS" /Yu"stdafx.h" /FD /c
  # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HARNESS_EXPORTS" /FD /c
  # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
  # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
  # ADD BASE RSC /l 0x409 /d "NDEBUG"
  # ADD RSC /l 0x409 /d "NDEBUG"
  BSC32=bscmake.exe
  # ADD BASE BSC32 /nologo
  # ADD BSC32 /nologo
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
  # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
  
  !ELSEIF  "$(CFG)" == "Harness - Win32 Debug"
  
  # PROP BASE Use_MFC 0
  # PROP BASE Use_Debug_Libraries 1
  # PROP BASE Output_Dir "Debug"
  # PROP BASE Intermediate_Dir "Debug"
  # PROP BASE Target_Dir ""
  # PROP Use_MFC 0
  # PROP Use_Debug_Libraries 1
  # PROP Output_Dir "..\..\Build\Win32\VC6\Debug"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Debug\Performance"
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HARNESS_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
  # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HARNESS_EXPORTS" /FD /GZ /c
  # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
  # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
  # ADD BASE RSC /l 0x409 /d "_DEBUG"
  # ADD RSC /l 0x409 /d "_DEBUG"
  BSC32=bscmake.exe
  # ADD BASE BSC32 /nologo
  # ADD BSC32 /nologo
  LINK32=link.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
  # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
  
  !ENDIF 
  
  # Begin Target
  
  # Name "Harness - Win32 Release"
  # Name "Harness - Win32 Debug"
  # Begin Group "Source Files"
  
  # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
  # Begin Source File
  
  SOURCE=.\XMLFileReporter.cpp
  # End Source File
  # End Group
  # Begin Group "Header Files"
  
  # PROP Default_Filter "h;hpp;hxx;hm;inl"
  # Begin Source File
  
  SOURCE=.\XMLFileReporter.hpp
  # End Source File
  # End Group
  # Begin Group "Resource Files"
  
  # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
  # End Group
  # End Target
  # End Project