You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ro...@locus.apache.org on 2000/01/19 01:59:22 UTC
cvs commit: xml-xerces/c/tests/ParserTest ParserTest.cpp ParserTest.hpp ParserTest_Parser.cpp ParserTest_Parser.hpp
roddey 00/01/18 16:59:22
Modified: c/tests/ParserTest ParserTest.cpp ParserTest.hpp
ParserTest_Parser.cpp ParserTest_Parser.hpp
Log:
Get rid of dependence on old utils output streams.
Revision Changes Path
1.3 +24 -36 xml-xerces/c/tests/ParserTest/ParserTest.cpp
Index: ParserTest.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/tests/ParserTest/ParserTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParserTest.cpp 2000/01/12 00:29:49 1.2
+++ ParserTest.cpp 2000/01/19 00:59:20 1.3
@@ -56,6 +56,9 @@
/**
* $Log: ParserTest.cpp,v $
+ * Revision 1.3 2000/01/19 00:59:20 roddey
+ * Get rid of dependence on old utils output streams.
+ *
* Revision 1.2 2000/01/12 00:29:49 roddey
* Changes for the new URL and InputSource changes.
*
@@ -73,31 +76,15 @@
// ---------------------------------------------------------------------------
#include <util/PlatformUtils.hpp>
#include <util/XMLString.hpp>
-#include <util/URL.hpp>
#include <internal/XMLScanner.hpp>
#include <validators/DTD/DTDValidator.hpp>
#include "ParserTest.hpp"
// ---------------------------------------------------------------------------
-// Global data
-//
-// errStrm
-// outStrm
-// The streams we use to output our test data and error info. These are
-// simple classes used just for XML4C2 samples and debug. They are not
-// sufficient for real applications, nor are they supported for
-// production code use. They merely provide a simple and portable means
-// to output the Unicode data from the parser on the local host.
-// ---------------------------------------------------------------------------
-XMLStdErr errStrm;
-XMLStdOut outStrm;
-
-
-// ---------------------------------------------------------------------------
// Program entry point
// ---------------------------------------------------------------------------
-int main(int argC, char** argV)
+extern "C" int wmain(int argC, wchar_t** argV)
{
// Init the XML platform
try
@@ -107,8 +94,8 @@
catch(const XMLException& toCatch)
{
- errStrm << "Error during platform init! Message:\n"
- << toCatch.getMessage() << EndLn;
+ std::wcerr << L"Error during platform init! Message:\n"
+ << toCatch.getMessage() << std::endl;
return 1;
}
@@ -125,39 +112,40 @@
XMLCh* urlPath = 0;
for (int index = 1; index < argC; index++)
{
- if (!XMLString::compareIString(argV[index], "/Debug"))
+ if (!XMLString::compareIString(argV[index], L"/Debug"))
parserTest.setOutputType(OutputType_Debug);
- else if (!XMLString::compareIString(argV[index], "/Validate"))
+ else if (!XMLString::compareIString(argV[index], L"/Validate"))
doValidation = true;
- else if (!XMLString::compareIString(argV[index], "/Namespaces"))
+ else if (!XMLString::compareIString(argV[index], L"/Namespaces"))
{
doNamespaces = true;
parserTest.setDoNamespaces(true);
}
- else if (!XMLString::compareIString(argV[index], "/XML"))
+ else if (!XMLString::compareIString(argV[index], L"/XML"))
parserTest.setOutputType(OutputType_XML);
- else if (!XMLString::compareIString(argV[index], "/IntDTD"))
+ else if (!XMLString::compareIString(argV[index], L"/IntDTD"))
parserTest.setShowIntDTD(true);
- else if (!XMLString::compareIString(argV[index], "/ShowWarnings"))
+ else if (!XMLString::compareIString(argV[index], L"/ShowWarnings"))
parserTest.setShowWarnings(true);
- else if (!XMLString::compareIString(argV[index], "/ShowErrLoc"))
+ else if (!XMLString::compareIString(argV[index], L"/ShowErrLoc"))
parserTest.setShowErrLoc(true);
- else if (!XMLString::compareIString(argV[index], "/JCCanon"))
+ else if (!XMLString::compareIString(argV[index], L"/JCCanon"))
parserTest.setOutputType(OutputType_JCCanon);
- else if (!XMLString::compareIString(argV[index], "/SunCanon"))
+ else if (!XMLString::compareIString(argV[index], L"/SunCanon"))
parserTest.setOutputType(OutputType_SunCanon);
- else if (!XMLString::compareIString(argV[index], "/KeepGoing"))
+ else if (!XMLString::compareIString(argV[index], L"/KeepGoing"))
keepGoing = true;
- else if (!XMLString::compareNIString(argV[index], "/URL=", 5))
- urlPath = XMLString::transcode(&argV[index][5]);
+ else if (!XMLString::compareNIString(argV[index], L"/URL=", 5))
+ urlPath = &argV[index][5];
else
- errStrm << "Unknown parameter: " << argV[index] << EndLn;
+ std::wcerr << L"Unknown parameter: "
+ << argV[index] << std::endl;
}
// We have to have a URL to work on
if (!urlPath)
{
- errStrm << "A URL must be provided, /URL=xxxx" << EndLn;
+ std::wcerr << L"A URL must be provided, /URL=xxxx" << std::endl;
return 1;
}
@@ -197,9 +185,9 @@
catch(const XMLException& toCatch)
{
- outStrm << "Exception during scan:\n "
- << toCatch.getMessage()
- << EndLn;
+ std::wcout << L"Exception during scan:\n "
+ << toCatch.getMessage()
+ << std::endl;
}
return 0;
}
1.2 +4 -8 xml-xerces/c/tests/ParserTest/ParserTest.hpp
Index: ParserTest.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/tests/ParserTest/ParserTest.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParserTest.hpp 1999/11/09 01:02:17 1.1
+++ ParserTest.hpp 2000/01/19 00:59:21 1.2
@@ -56,9 +56,12 @@
/**
* $Log: ParserTest.hpp,v $
- * Revision 1.1 1999/11/09 01:02:17 twl
- * Initial revision
+ * Revision 1.2 2000/01/19 00:59:21 roddey
+ * Get rid of dependence on old utils output streams.
*
+ * Revision 1.1.1.1 1999/11/09 01:02:17 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:42:25 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -80,12 +83,5 @@
// ---------------------------------------------------------------------------
// Includes that everyone uses inside this program
// ---------------------------------------------------------------------------
-#include <util/StdOut.hpp>
#include "ParserTest_Parser.hpp"
-
-
-// ---------------------------------------------------------------------------
-// Global data externs for everyone to see. These are from the main Cpp file
-// ---------------------------------------------------------------------------
-extern XMLStdOut outStrm;
-extern XMLStdErr errStrm;
+#include <iostream>
1.2 +226 -207 xml-xerces/c/tests/ParserTest/ParserTest_Parser.cpp
Index: ParserTest_Parser.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/tests/ParserTest/ParserTest_Parser.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParserTest_Parser.cpp 1999/11/09 01:02:22 1.1
+++ ParserTest_Parser.cpp 2000/01/19 00:59:21 1.2
@@ -56,9 +56,12 @@
/**
* $Log: ParserTest_Parser.cpp,v $
- * Revision 1.1 1999/11/09 01:02:22 twl
- * Initial revision
+ * Revision 1.2 2000/01/19 00:59:21 roddey
+ * Get rid of dependence on old utils output streams.
*
+ * Revision 1.1.1.1 1999/11/09 01:02:22 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:42:25 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -82,7 +85,6 @@
#include <validators/DTD/DTDEntityDecl.hpp>
#include "ParserTest.hpp"
-#include <util/BitOps.hpp>
// ---------------------------------------------------------------------------
// Local functions
@@ -128,10 +130,10 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got CHARS:\n Bytes: "
- << length << ", CDATA?: "
- << (cdataSection ? "Yes" : "No")
- << "\n" << EndLn;
+ std::wcout << L"Got CHARS:\n Bytes: "
+ << length << L", CDATA?: "
+ << (cdataSection ? L"Yes" : L"No")
+ << L"\n" << std::endl;
}
else if ((fOutputType == OutputType_JCCanon)
|| (fOutputType == OutputType_SunCanon))
@@ -141,10 +143,10 @@
else if (fOutputType == OutputType_XML)
{
if (cdataSection)
- outStrm << "<![CDATA[";
+ std::wcout << L"<![CDATA[";
showChars(chars, length);
if (cdataSection)
- outStrm << "]]>";
+ std::wcout << L"]]>";
}
}
@@ -152,15 +154,15 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got document COMMENT:\n "
- << "Text: \"" << comment << "\"\n"
- << EndLn;
+ std::wcout << L"Got document COMMENT:\n "
+ << L"Text: \"" << comment << L"\"\n"
+ << std::endl;
}
else if (fOutputType == OutputType_XML)
{
- outStrm << "<!--";
+ std::wcout << L"<!--";
showString(comment);
- outStrm << "-->";
+ std::wcout << L"-->";
}
}
@@ -169,24 +171,24 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got document PI:\n "
- << "Target: \"" << target << '"';
+ std::wcout << L"Got document PI:\n "
+ << L"Target: \"" << target << '"';
if (XMLString::stringLen(data))
- outStrm << ", Data: \"" << data << '"';
+ std::wcout << L", Data: \"" << data << '"';
- outStrm << "\n" << EndLn;
+ std::wcout << L"\n" << std::endl;
}
else if ((fOutputType == OutputType_XML)
|| (fOutputType == OutputType_JCCanon)
|| (fOutputType == OutputType_SunCanon))
{
- outStrm << "<?";
+ std::wcout << L"<?";
showString(target);
- outStrm << " ";
+ std::wcout << L" ";
if (XMLString::stringLen(data))
- outStrm << data;
- outStrm << "?>";
+ std::wcout << data;
+ std::wcout << L"?>";
}
}
@@ -195,11 +197,11 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ENDDOCUMENT:\n" << EndLn;
+ std::wcout << L"Got ENDDOCUMENT:\n" << std::endl;
}
else if (fOutputType == OutputType_SunCanon)
{
- outStrm << "\r\n";
+ std::wcout << L"\r\n";
}
}
@@ -214,26 +216,26 @@
XMLBuffer bufURI;
fScanner->getValidator()->getURIText(uriId, bufURI);
- outStrm << "Got ENDELEMENT:\n Name: "
- << "Name: {" << bufURI.getRawBuffer() << "}"
- << elemDecl.getBaseName()
- << EndLn;
+ std::wcout << L"Got ENDELEMENT:\n Name: "
+ << L"Name: {" << bufURI.getRawBuffer() << L"}"
+ << elemDecl.getBaseName()
+ << std::endl;
}
else
{
- outStrm << "Got ENDELEMENT:\n Name: "
- << elemDecl.getFullName() << EndLn;
+ std::wcout << L"Got ENDELEMENT:\n Name: "
+ << elemDecl.getFullName() << std::endl;
}
- outStrm << EndLn;
+ std::wcout << std::endl;
}
else if ((fOutputType == OutputType_XML)
|| (fOutputType == OutputType_JCCanon)
|| (fOutputType == OutputType_SunCanon))
{
- outStrm << "</";
+ std::wcout << L"</";
showString(elemDecl.getFullName());
- outStrm << ">";
+ std::wcout << L">";
}
// Clear the flag that says we're now inside the root
@@ -245,8 +247,9 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ENDENTITYREF:\n "
- << "Name: " << entDecl.getName() << "\n" << EndLn;
+ std::wcout << L"Got ENDENTITYREF:\n "
+ << L"Name: " << entDecl.getName() << L"\n"
+ << std::endl;
}
}
@@ -256,18 +259,18 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got WHITESPACE:\n Bytes: "
- << length << ", CDATA?: "
- << (cdataSection ? "Yes" : "No")
- << "\n" << EndLn;
+ std::wcout << L"Got WHITESPACE:\n Bytes: "
+ << length << L", CDATA?: "
+ << (cdataSection ? L"Yes" : L"No")
+ << L"\n" << std::endl;
}
else if (fOutputType == OutputType_XML)
{
if (cdataSection)
- outStrm << "<![CDATA[";
+ std::wcout << L"<![CDATA[";
showChars(chars, length);
if (cdataSection)
- outStrm << "]]>";
+ std::wcout << L"]]>";
}
else if ((fOutputType == OutputType_JCCanon)
|| (fOutputType == OutputType_SunCanon))
@@ -281,13 +284,13 @@
void TestParser::resetDocument()
{
if (fOutputType == OutputType_Debug)
- outStrm << "Got RESETDOCUMENT:\n" << EndLn;
+ std::wcout << L"Got RESETDOCUMENT:\n" << std::endl;
}
void TestParser::startDocument()
{
if (fOutputType == OutputType_Debug)
- outStrm << "Got STARTDOCUMENT:\n" << EndLn;
+ std::wcout << L"Got STARTDOCUMENT:\n" << std::endl;
}
void
@@ -309,86 +312,91 @@
if (fDoNamespaces)
{
fScanner->getValidator()->getURIText(uriId, bufURI);
- outStrm << "Got STARTELEMENT:\n "
- << " Name: {" << bufURI.getRawBuffer() << "}" << elemDecl.getBaseName()
- << ", AttCount: " << attCount
- << ", Empty?: "
- << (isEmpty ? "yes" : "no")
- << "\n";
+ std::wcout << L"Got STARTELEMENT:\n "
+ << L" Name: {" << bufURI.getRawBuffer()
+ << L"}" << elemDecl.getBaseName()
+ << L", AttCount: " << attCount
+ << L", Empty?: "
+ << (isEmpty ? L"yes" : L"no")
+ << L"\n";
}
else
{
- outStrm << "Got STARTELEMENT:\n "
- << " Name: " << elemDecl.getFullName()
- << ", AttCount: " << attCount
- << ", Empty?: "
- << (isEmpty ? "yes" : "no")
- << "\n";
+ std::wcout << L"Got STARTELEMENT:\n "
+ << L" Name: " << elemDecl.getFullName()
+ << L", AttCount: " << attCount
+ << L", Empty?: "
+ << (isEmpty ? L"yes" : L"no")
+ << L"\n";
}
// If any attributes, then show them
if (attCount)
{
- outStrm << " Attrs: ";
+ std::wcout << L" Attrs: ";
for (unsigned int attInd = 0; attInd < attCount; attInd++)
{
const XMLAttr* curAttr = attrList.elementAt(attInd);
if (fDoNamespaces)
{
- fScanner->getValidator()->getURIText(curAttr->getURIId(), bufURI);
- outStrm << "{" << bufURI.getRawBuffer()
- << "}" << curAttr->getName() << "="
- << curAttr->getValue() << "\n";
+ fScanner->getValidator()->getURIText
+ (
+ curAttr->getURIId()
+ , bufURI
+ );
+ std::wcout << L"{" << bufURI.getRawBuffer()
+ << L"}" << curAttr->getName() << L"="
+ << curAttr->getValue() << L"\n";
}
else
{
- outStrm << curAttr->getQName() << "="
- << curAttr->getValue() << "\n";
+ std::wcout << curAttr->getQName() << L"="
+ << curAttr->getValue() << L"\n";
}
- outStrm << " ";
+ std::wcout << L" ";
}
}
- outStrm << EndLn;
+ std::wcout << std::endl;
}
else if (fOutputType == OutputType_XML)
{
- outStrm << "<";
+ std::wcout << L"<";
showString(elemDecl.getFullName());
if (attCount)
{
- outStrm << " ";
+ std::wcout << L" ";
for (unsigned int index = 0; index < attCount; index++)
{
const XMLAttr* curAttr = attrList.elementAt(index);
showString(curAttr->getQName());
- outStrm << "=\"";
+ std::wcout << L"=\"";
showString(curAttr->getValue());
- outStrm << "\"";
+ std::wcout << L"\"";
if (index < attCount-1)
- outStrm << " ";
+ std::wcout << L" ";
}
}
if (isEmpty)
- outStrm << "/>";
+ std::wcout << L"/>";
else
- outStrm << ">";
+ std::wcout << L">";
}
else if ((fOutputType == OutputType_JCCanon)
|| (fOutputType == OutputType_SunCanon))
{
- outStrm << "<";
+ std::wcout << L"<";
showString(elemDecl.getFullName());
if (attCount)
{
- outStrm << " ";
+ std::wcout << L" ";
//
// Get a list of attribute pointers. The canonical output
@@ -408,25 +416,25 @@
{
const XMLAttr* curAttr = attrTmp[index];
showString(curAttr->getQName());
- outStrm << "=\"";
+ std::wcout << L"=\"";
showString(curAttr->getValue());
- outStrm << "\"";
+ std::wcout << L"\"";
if (index < attCount-1)
- outStrm << " ";
+ std::wcout << L" ";
}
delete [] attrTmp;
}
if (isEmpty)
{
- outStrm << "></";
+ std::wcout << L"></";
showString(elemDecl.getFullName());
- outStrm << ">";
+ std::wcout << L">";
}
else
{
- outStrm << ">";
+ std::wcout << L">";
}
}
}
@@ -435,8 +443,8 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got STARTENTITY:\n "
- << "Name: " << entDecl.getName() << "\n" << EndLn;
+ std::wcout << L"Got STARTENTITY:\n "
+ << L"Name: " << entDecl.getName() << L"\n" << std::endl;
}
}
@@ -447,28 +455,28 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got XMLDECL:\n "
- << "Version:\"" << versionStr << "\""
- << " Encoding:\"" << encodingStr << "\""
- << " Standalone:\"" << standaloneStr << "\""
- << " Auto Encoding:\"" << autoEncStr << "\""
- << "\n"
- << EndLn;
+ std::wcout << L"Got XMLDECL:\n "
+ << L"Version:\"" << versionStr << L"\""
+ << L" Encoding:\"" << encodingStr << L"\""
+ << L" Standalone:\"" << standaloneStr << L"\""
+ << L" Auto Encoding:\"" << autoEncStr << L"\""
+ << L"\n"
+ << std::endl;
}
else if (fOutputType == OutputType_XML)
{
- outStrm << "<?xml";
+ std::wcout << L"<?xml";
if (XMLString::stringLen(versionStr))
- outStrm << " version=\"" << versionStr << '"';
+ std::wcout << L" version=\"" << versionStr << '"';
if (XMLString::stringLen(encodingStr))
- outStrm << " encoding=\"" << encodingStr << '"';
+ std::wcout << L" encoding=\"" << encodingStr << '"';
if (XMLString::stringLen(standaloneStr))
- outStrm << " standlone=\"" << standaloneStr << '"';
+ std::wcout << L" standlone=\"" << standaloneStr << '"';
- outStrm << " ?>";
+ std::wcout << L" ?>";
}
}
@@ -482,17 +490,17 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ATTDEF:\n "
- << "Name: " << attDef.getFullName()
- << ", Type: "
- << XMLAttDef::getAttTypeString(attDef.getType())
- << ", DefType: "
- << XMLAttDef::getDefAttTypeString(attDef.getDefaultType());
+ std::wcout << L"Got ATTDEF:\n "
+ << L"Name: " << attDef.getFullName()
+ << L", Type: "
+ << XMLAttDef::getAttTypeString(attDef.getType())
+ << L", DefType: "
+ << XMLAttDef::getDefAttTypeString(attDef.getDefaultType());
if (XMLString::stringLen(attDef.getValue()))
- outStrm << ", Value: \"" << attDef.getValue() << '"';
+ std::wcout << L", Value: \"" << attDef.getValue() << '"';
- outStrm << "\n" << EndLn;
+ std::wcout << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -501,33 +509,33 @@
if (fIntDTDOutput)
{
- outStrm << attDef.getFullName() << " ";
+ std::wcout << attDef.getFullName() << L" ";
if (attDef.getType() == XMLAttDef::Enumeration)
{
- outStrm << chOpenParen;
+ std::wcout << chOpenParen;
const XMLCh* curCh = attDef.getEnumeration();
while (*curCh)
{
while (!XMLReader::isWhitespace(*curCh))
- outStrm << *curCh++;
+ std::wcout << *curCh++;
curCh++;
if (*curCh)
- outStrm << chPipe;
+ std::wcout << chPipe;
}
- outStrm << chCloseParen;
+ std::wcout << chCloseParen;
}
else
{
- outStrm << XMLAttDef::getAttTypeString(attDef.getType());
+ std::wcout << XMLAttDef::getAttTypeString(attDef.getType());
}
if (XMLString::stringLen(attDef.getValue()))
- outStrm << " \"" << attDef.getValue() << '"';
+ std::wcout << L" \"" << attDef.getValue() << '"';
if (attDef.getDefaultType() != XMLAttDef::Default)
{
- outStrm << " "
- << XMLAttDef::getDefAttTypeString(attDef.getDefaultType());
+ std::wcout << L" "
+ << XMLAttDef::getDefAttTypeString(attDef.getDefaultType());
}
}
}
@@ -537,9 +545,9 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got DTD COMMENT:\n "
- << "Text: \"" << comment << "\"\n"
- << EndLn;
+ std::wcout << L"Got DTD COMMENT:\n "
+ << L"Text: \"" << comment << L"\"\n"
+ << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -547,7 +555,7 @@
return;
if (fIntDTDOutput)
- outStrm << "<!--" << comment << "-->";
+ std::wcout << L"<!--" << comment << L"-->";
}
}
@@ -558,26 +566,26 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got DOCTYPE:\n "
- << "Root: " << elemDecl.getFullName();
+ std::wcout << L"Got DOCTYPE:\n "
+ << L"Root: " << elemDecl.getFullName();
if (XMLString::stringLen(publicId))
- outStrm << ", PUBLIC: " << publicId;
+ std::wcout << L", PUBLIC: " << publicId;
if (XMLString::stringLen(systemId))
- outStrm << ", SYSTEM: " << systemId;
+ std::wcout << L", SYSTEM: " << systemId;
- outStrm << "\n" << EndLn;
+ std::wcout << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
if (fIntDTDOutput)
{
- outStrm << "<!DOCTYPE " << elemDecl.getFullName();
+ std::wcout << L"<!DOCTYPE " << elemDecl.getFullName();
showIds(publicId, systemId);
if (!hasIntSubset)
- outStrm << ">";
+ std::wcout << L">";
}
}
}
@@ -587,12 +595,12 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got DTD PI:\n "
- << "Target: \"" << target << '"';
+ std::wcout << L"Got DTD PI:\n "
+ << L"Target: \"" << target << '"';
if (XMLString::stringLen(data))
- outStrm << ", Data: \"" << data << '"';
- outStrm << "\n" << EndLn;
+ std::wcout << L", Data: \"" << data << '"';
+ std::wcout << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -601,10 +609,10 @@
if (fIntDTDOutput)
{
- outStrm << "<?" << target;
+ std::wcout << L"<?" << target;
if (XMLString::stringLen(data))
- outStrm << " " << data;
- outStrm << "?>";
+ std::wcout << L" " << data;
+ std::wcout << L"?>";
}
}
}
@@ -614,8 +622,8 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got DTD Spaces:\n Bytes: "
- << length << "\n" << EndLn;
+ std::wcout << L"Got DTD Spaces:\n Bytes: "
+ << length << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -632,15 +640,15 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ELEMENT DECL:\n "
- << "Name: " << decl.getFullName();
+ std::wcout << L"Got ELEMENT DECL:\n "
+ << L"Name: " << decl.getFullName();
if (isIgnored)
- outStrm << " (Ignored)";
+ std::wcout << L" (Ignored)";
- outStrm << ", Content: ";
- outStrm << decl.getFormattedContentModel(*fScanner->getValidator());
- outStrm << "\n" << EndLn;
+ std::wcout << L", Content: ";
+ std::wcout << decl.getFormattedContentModel(*fScanner->getValidator());
+ std::wcout << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -649,9 +657,9 @@
if (fIntDTDOutput)
{
- outStrm << "<!ELEMENT " << decl.getFullName() << " ";
- outStrm << decl.getFormattedContentModel(*fScanner->getValidator());
- outStrm << ">";
+ std::wcout << L"<!ELEMENT " << decl.getFullName() << L" ";
+ std::wcout << decl.getFormattedContentModel(*fScanner->getValidator());
+ std::wcout << L">";
}
}
}
@@ -660,9 +668,9 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ENDATTLIST:\n "
- << "Name: " << elemDecl.getFullName() << "\n"
- << EndLn;
+ std::wcout << L"Got ENDATTLIST:\n "
+ << L"Name: " << elemDecl.getFullName() << L"\n"
+ << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -670,7 +678,7 @@
return;
if (fIntDTDOutput)
- outStrm << ">";
+ std::wcout << L">";
}
}
@@ -678,12 +686,12 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ENDINTSUBSET\n" << EndLn;
+ std::wcout << L"Got ENDINTSUBSET\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
if (fIntDTDOutput)
- outStrm << "]>";
+ std::wcout << L"]>";
}
}
@@ -691,7 +699,7 @@
{
fInExtSubset = false;
if (fOutputType == OutputType_Debug)
- outStrm << "Got ENDEXTSUBSET\n" << EndLn;
+ std::wcout << L"Got ENDEXTSUBSET\n" << std::endl;
}
void TestParser::entityDecl(const DTDEntityDecl& entityDecl
@@ -700,10 +708,10 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got ENTITYDECL:\n "
- << "Name: " << entityDecl.getName()
- << (isPEDecl ? " [Parameter Entity]" : " [General Entity]")
- << "\n" << EndLn;
+ std::wcout << L"Got ENTITYDECL:\n "
+ << L"Name: " << entityDecl.getName()
+ << (isPEDecl ? L" [Parameter Entity]" : L" [General Entity]")
+ << L"\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -712,17 +720,17 @@
if (fIntDTDOutput)
{
- outStrm << "<!ENTITY ";
+ std::wcout << L"<!ENTITY ";
if (isPEDecl)
- outStrm << "% ";
- outStrm << entityDecl.getName();
+ std::wcout << L"% ";
+ std::wcout << entityDecl.getName();
if (entityDecl.isExternal())
showIds(entityDecl.getPublicId(), entityDecl.getSystemId());
else
- outStrm << " \"" << entityDecl.getValue() << "\"";
+ std::wcout << L" \"" << entityDecl.getValue() << L"\"";
- outStrm << ">";
+ std::wcout << L">";
}
}
}
@@ -730,7 +738,7 @@
void TestParser::resetDocType()
{
if (fOutputType == OutputType_Debug)
- outStrm << "Got RESETDOCTYPE:\n" << EndLn;
+ std::wcout << L"Got RESETDOCTYPE:\n" << std::endl;
}
void TestParser::notationDecl( const XMLNotationDecl& notDecl
@@ -738,9 +746,9 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got NOTATIONDECL:\n "
- << "Name: " << notDecl.getName()
- << EndLn;
+ std::wcout << L"Got NOTATIONDECL:\n "
+ << L"Name: " << notDecl.getName()
+ << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -749,20 +757,20 @@
if (fIntDTDOutput)
{
- outStrm << "<!NOTATION " << notDecl.getName() << " ";
+ std::wcout << L"<!NOTATION " << notDecl.getName() << L" ";
if (!XMLString::stringLen(notDecl.getSystemId()))
- outStrm << "PUBLIC ";
+ std::wcout << L"PUBLIC ";
else
- outStrm << "SYSTEM ";
+ std::wcout << L"SYSTEM ";
if (XMLString::stringLen(notDecl.getPublicId()))
- outStrm << "\"" << notDecl.getPublicId() << '"';
+ std::wcout << L"\"" << notDecl.getPublicId() << '"';
if (XMLString::stringLen(notDecl.getSystemId()))
- outStrm << " \"" << notDecl.getSystemId() << '"';
+ std::wcout << L" \"" << notDecl.getSystemId() << '"';
- outStrm << ">";
+ std::wcout << L">";
}
}
}
@@ -771,9 +779,9 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got STARTATTLIST:\n "
- << "Name: " << elemDecl.getFullName() << "\n"
- << EndLn;
+ std::wcout << L"Got STARTATTLIST:\n "
+ << L"Name: " << elemDecl.getFullName() << L"\n"
+ << std::endl;
}
else if (fOutputType != OutputType_None)
{
@@ -781,7 +789,7 @@
return;
if (fIntDTDOutput)
- outStrm << "<!ATTLIST " << elemDecl.getFullName();
+ std::wcout << "<!ATTLIST " << elemDecl.getFullName();
}
}
@@ -789,12 +797,12 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got STARTINTSUBSET\n" << EndLn;
+ std::wcout << L"Got STARTINTSUBSET\n" << std::endl;
}
else if (fOutputType != OutputType_None)
{
if (fIntDTDOutput)
- outStrm << " [";
+ std::wcout << L" [";
}
}
@@ -802,7 +810,7 @@
{
fInExtSubset = true;
if (fOutputType == OutputType_Debug)
- outStrm << "Got STARTEXTSUBSET\n" << EndLn;
+ std::wcout << L"Got STARTEXTSUBSET\n" << std::endl;
}
void TestParser::TextDecl( const XMLCh* const versionStr
@@ -810,15 +818,15 @@
{
if (fOutputType == OutputType_Debug)
{
- outStrm << "Got TEXTDECL:\n ";
+ std::wcout << L"Got TEXTDECL:\n ";
if (XMLString::stringLen(versionStr))
- outStrm << "Version: " << versionStr;
+ std::wcout << L"Version: " << versionStr;
if (XMLString::stringLen(encodingStr))
- outStrm << "Encoding: " << encodingStr;
+ std::wcout << L"Encoding: " << encodingStr;
- outStrm << "\n" << EndLn;
+ std::wcout << L"\n" << std::endl;
}
}
@@ -858,10 +866,10 @@
if (ofs != -1)
entName = &systemId[ofs + 1];
- outStrm << lineNum << "/" << colNum
- << L":" << entName
- << L" - " << text
- << EndLn;
+ std::wcout << lineNum << L"/" << colNum
+ << L":" << entName
+ << L" - " << text
+ << std::endl;
return;
}
@@ -869,40 +877,37 @@
if ((type == XMLErrorReporter::ErrType_Warning) && !fShowWarnings)
return;
- const char* typeStr = "?";
+ const XMLCh* typeStr = L"?";
if (type == XMLErrorReporter::ErrType_Fatal)
- typeStr = "ERROR";
+ typeStr = L"ERROR";
else if (type == XMLErrorReporter::ErrType_Warning)
- typeStr = "WARNING";
+ typeStr = L"WARNING";
else if (type == XMLErrorReporter::ErrType_Invalid)
- typeStr = "VALIDITY";
-
- // Save the stream flags so that we can restore them
- StreamJanitor strmJan(&errStrm);
+ typeStr = L"VALIDITY";
// Output the error heading and the error type string
- outStrm << "\nError: (" << typeStr;
+ std::wcout << L"\nError: (" << typeStr;
// If we have either id, display them
if (XMLString::stringLen(systemId))
- outStrm << ", System Id: " << systemId;
+ std::wcout << L", System Id: " << systemId;
if (XMLString::stringLen(publicId))
- outStrm << ", Public Id: " << publicId;
+ std::wcout << L", Public Id: " << publicId;
// Display the position information
- outStrm << DecimalRadix
- << ", Line/Col: " << lineNum << "/" << colNum
- << ")\n";
+ std::wcout << std::hex
+ << L", Line/Col: " << lineNum << L"/" << colNum
+ << std::dec << L")\n";
// And finally the error text
- outStrm << text << EndLn;
+ std::wcout << text << std::endl;
}
void TestParser::resetErrors()
{
if (fOutputType == OutputType_Debug)
- outStrm << "Got RESETERRORS:\n" << EndLn;
+ std::wcout << L"Got RESETERRORS:\n" << std::endl;
}
@@ -934,7 +939,7 @@
{
if (index == length)
{
- errStrm << "Missing trailing surrogate\n" << EndLn;
+ std::wcerr << L"Missing trailing surrogate\n" << std::endl;
break;
}
@@ -995,27 +1000,35 @@
if (doCan)
{
if (toShow == chLF)
- outStrm << " ";
+ std::wcout << L" ";
else if (toShow == chHTab)
- outStrm << "	";
+ std::wcout << L"	";
else if (toShow == chCR)
- outStrm << " ";
+ std::wcout << L" ";
else if (toShow == chSingleQuote)
- outStrm << "'";
+ std::wcout << L"'";
else if (toShow == chAmpersand)
- outStrm << "&";
+ std::wcout << L"&";
else if (toShow == chDoubleQuote)
- outStrm << """;
+ std::wcout << L""";
else if (toShow == chOpenAngle)
- outStrm << "<";
+ std::wcout << L"<";
else if (toShow == chCloseAngle)
- outStrm << ">";
+ std::wcout << L">";
else
- outStrm << toShow;
+ {
+ wchar_t tmpStr[2];
+ tmpStr[0] = toShow;
+ tmpStr[1] = 0;
+ std::wcout << tmpStr;
+ }
}
else
{
- outStrm << toShow;
+ wchar_t tmpStr[2];
+ tmpStr[0] = toShow;
+ tmpStr[1] = 0;
+ std::wcout << tmpStr;
}
}
@@ -1026,13 +1039,19 @@
{
if (!XMLString::stringLen(publicId))
{
- outStrm << " SYSTEM '" << systemId << "'";
+ std::wcout << L" SYSTEM '" << systemId << L"'";
}
else
{
- outStrm << " PUBLIC '" << publicId << "'";
+ std::wcout << L" PUBLIC '" << publicId << L"'";
if (systemId)
- outStrm << " '" << systemId << "'";
+ std::wcout << L" '" << systemId << L"'";
}
}
+}
+
+
+inline void TestParser::showString(const XMLCh* const toShow)
+{
+ showChars(toShow, XMLString::stringLen(toShow));
}
1.2 +3 -8 xml-xerces/c/tests/ParserTest/ParserTest_Parser.hpp
Index: ParserTest_Parser.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/tests/ParserTest/ParserTest_Parser.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParserTest_Parser.hpp 1999/11/09 01:02:23 1.1
+++ ParserTest_Parser.hpp 2000/01/19 00:59:21 1.2
@@ -56,9 +56,12 @@
/**
* $Log: ParserTest_Parser.hpp,v $
- * Revision 1.1 1999/11/09 01:02:23 twl
- * Initial revision
+ * Revision 1.2 2000/01/19 00:59:21 roddey
+ * Get rid of dependence on old utils output streams.
*
+ * Revision 1.1.1.1 1999/11/09 01:02:23 twl
+ * Initial checkin
+ *
* Revision 1.3 1999/11/08 20:42:25 rahul
* Swat for adding in Product name and CVS comment log variable.
*
@@ -381,11 +384,3 @@
fShowErrLoc = state;
}
-
-// ---------------------------------------------------------------------------
-// TestParser: Private helpers
-// ---------------------------------------------------------------------------
-inline void TestParser::showString(const XMLCh* const toShow)
-{
- showChars(toShow, XMLString::stringLen(toShow));
-}