dbertoni 01/11/30 09:46:17
Modified: c/Tests/Conf conf.cpp
Log:
Fixed a few glitches. Make sure the proper parser options are set.
Revision Changes Path
1.11 +41 -29 xml-xalan/c/Tests/Conf/conf.cpp
Index: conf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Conf/conf.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- conf.cpp 2001/11/27 16:57:55 1.10
+++ conf.cpp 2001/11/30 17:46:17 1.11
@@ -96,17 +96,11 @@
#include <crtdbg.h>
#endif
-const char* const excludeStylesheets[] =
-{
- "output22.xsl",
- "entref01.xsl",
- "select73.xsl",
- "sort07.xsl",
- 0
-};
FileUtility futil;
+
+
void
printArgOptions()
{
@@ -270,12 +264,25 @@
}
+
+static const char* const excludeStylesheets[] =
+{
+ "output22.xsl",
+ "entref01.xsl",
+ "select73.xsl",
+ "sort07.xsl",
+ 0
+};
+
+
+
+
inline bool
-checkForExclusion(XalanDOMString currentFile)
+checkForExclusion(const XalanDOMString& currentFile)
{
- for (int i=0; excludeStylesheets[i] != 0; i++)
+ for (size_t i = 0; excludeStylesheets[i] != 0; ++i)
{
- if (equals(currentFile, XalanDOMString(excludeStylesheets[i])))
+ if (equals(currentFile, excludeStylesheets[i]))
{
return true;
}
@@ -284,8 +291,10 @@
return false;
}
+
+
void
-parseWithTransformer(int &sourceType, XalanTransformer &xalan, const
XSLTInputSource &xmlInput,
+parseWithTransformer(int sourceType, XalanTransformer &xalan, const
XSLTInputSource &xmlInput,
const XalanCompiledStylesheet*
styleSheet, const XSLTResultTarget &output,
XMLFileReporter &logFile)
{
@@ -306,7 +315,7 @@
{
// Report the failure and be sure to increment fail count.
cout << "Failed to PARSE source document for " <<
futil.data.testOrFile << endl;
- futil.data.fail += 1;
+ ++futil.data.fail;
logFile.logErrorResult(futil.data.testOrFile,
XalanDOMString("Failed to PARSE source document."));
}
@@ -317,39 +326,43 @@
void
-parseWithXerces(int &sourceType, XalanTransformer &xalan, const
XSLTInputSource &xmlInput,
+parseWithXerces(int sourceType, XalanTransformer &xalan, const
XSLTInputSource &xmlInput,
const XalanCompiledStylesheet* styleSheet,
const XSLTResultTarget &output,
XMLFileReporter &logFile)
{
- const XercesDOMWrapperParsedSource* parsedSource = 0;
futil.data.xmlFormat = XalanDOMString("Xerces_DOM");
-
+
DOMParser theParser;
theParser.setToCreateXMLDeclTypeNode(false);
+ theParser.setDoValidation(true);
+ theParser.setDoNamespaces(true);
theParser.parse(xmlInput);
- const DOM_Document theDOM = theParser.getDocument();
+ DOM_Document theDOM = theParser.getDocument();
+ theDOM.normalize();
+
XercesDOMSupport theDOMSupport;
XercesParserLiaison theParserLiaison(theDOMSupport);
- parsedSource = new XercesDOMWrapperParsedSource(theDOM,
-
theParserLiaison,
- theDOMSupport,
-
XalanDOMString(xmlInput.getSystemId()));
+ try
+ {
+ const XercesDOMWrapperParsedSource parsedSource(
+ theDOM,
+ theParserLiaison,
+ theDOMSupport,
+ XalanDOMString(xmlInput.getSystemId()));
- if (parsedSource == 0)
+ xalan.transform(parsedSource, styleSheet, output);
+ }
+ catch(...)
{
// Report the failure and be sure to increment fail count.
cout << "Failed to PARSE source document for " <<
futil.data.testOrFile << endl;
- futil.data.fail += 1;
+ ++futil.data.fail;
logFile.logErrorResult(futil.data.testOrFile,
XalanDOMString("Failed to PARSE source document."));
}
-
- xalan.transform(*parsedSource, styleSheet, output);
- delete parsedSource;
-
}
int
@@ -380,8 +393,7 @@
XalanTransformer xalan;
// Generate Unique Run id and processor info
- const XalanDOMString& UniqRunid = futil.generateUniqRunid();
-
+ const XalanDOMString UniqRunid = futil.generateUniqRunid();
// Defined basic constants for file manipulation and open
results file
const XalanDOMString drive(futil.getDrive());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]