You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by David N Bertoni <db...@locus.apache.org> on 2000/07/06 22:35:15 UTC
cvs commit: xml-xalan/c/src/TestXSLT process.cpp
dbertoni 00/07/06 13:35:14
Modified: c/src/TestXSLT process.cpp
Log:
Added some extra output goodies, and fixed destruction/reset order.
Revision Changes Path
1.27 +118 -11 xml-xalan/c/src/TestXSLT/process.cpp
Index: process.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/TestXSLT/process.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- process.cpp 2000/06/30 21:31:57 1.26
+++ process.cpp 2000/07/06 20:35:14 1.27
@@ -179,7 +179,11 @@
<< endl
<< " [-PARAM name expression (Set a stylesheet parameter)]"
<< endl
+#if !defined(NDEBUG)
+ << " [-S (Display some interesting statistics.)]"
<< endl
+#endif
+ << endl
<< "The following options are valid only with -HTML or -XML."
<< endl
<< endl
@@ -216,6 +220,9 @@
bool traceSelectionEvent;
bool traceTemplateChildren;
bool shouldWriteXMLHeader;
+#if !defined(NDEBUG)
+ bool showStats;
+#endif
int indentAmount;
int outputType;
string outFileName;
@@ -237,6 +244,9 @@
traceSelectionEvent(false),
traceTemplateChildren(false),
shouldWriteXMLHeader(true),
+#if !defined(NDEBUG)
+ showStats(false),
+#endif
indentAmount(0),
outputType(-1),
specialCharacters(),
@@ -377,6 +387,12 @@
fSuccess = false;
}
}
+#if !defined(NDEBUG)
+ else if(!stricmp("-S", argv[i]))
+ {
+ p.showStats = true;
+ }
+#endif
else if(!stricmp("-V", argv[i]))
{
p.versionOnly = true;
@@ -615,8 +631,6 @@
DOMSupportDefault theDOMSupport;
XercesParserLiaison xmlParserLiaison(theDOMSupport);
- DOMStringPrintWriter pw;
-
XPathSupportDefault theXPathSupport(theDOMSupport);
XSLTProcessorEnvSupportDefault theXSLProcessorSupport;
XObjectFactoryDefault theXObjectFactory(theXSLProcessorSupport, theXPathSupport);
@@ -697,11 +711,6 @@
const StylesheetRoot* stylesheet = 0;
- StylesheetExecutionContextDefault theExecutionContext(processor,
- theXSLProcessorSupport,
- theXPathSupport,
- theXObjectFactory);
-
if (!isEmpty(xslFileName))
{
stylesheet = processor.processStylesheet(xslFileName, theConstructionContext);
@@ -737,6 +746,11 @@
// Do the transformation...
XSLTInputSource theInputSource(params.inFileName.c_str());
+ StylesheetExecutionContextDefault theExecutionContext(processor,
+ theXSLProcessorSupport,
+ theXPathSupport,
+ theXObjectFactory);
+
if (stylesheet == 0)
{
// No stylesheet, so our only hope is that the xml file has
@@ -762,12 +776,103 @@
theExecutionContext);
}
+#if !defined(NDEBUG)
+ if (params.showStats == true)
+ {
+ cerr << endl
+ << "Execution XObject details:"
+ << endl
+ << endl
+ << "Total number of XBoolean instances created: "
+ << theXObjectFactory.getTotalBooleanInstanceCount()
+ << endl
+ << "Total number of XNodeSet instances created: "
+ << theXObjectFactory.getTotalNodeSetInstanceCount()
+ << endl
+ << "Total number of XNull instances created: "
+ << theXObjectFactory.getTotalNullInstanceCount()
+ << endl
+ << "Total number of XNumber instances created: "
+ << theXObjectFactory.getTotalNumberInstanceCount()
+ << endl
+ << "Total number of XResultTreeFrag instances created: "
+ << theXObjectFactory.getTotalResultTreeFragInstanceCount()
+ << endl
+ << "Total number of XString instances created: "
+ << theXObjectFactory.getTotalStringInstanceCount()
+ << endl
+ << "Total number of XUnknown instances created: "
+ << theXObjectFactory.getTotalUnknownInstanceCount()
+ << endl
+ << endl
+ << "Execution XPath details:"
+ << endl
+ << endl
+ << "Total number of XPath instances created: "
+ << theXPathFactory.getTotalInstanceCount()
+ << endl
+ << endl;
+
+ cerr << endl
+ << "Stylesheet XObject details:"
+ << endl
+ << endl
+ << "Total number of XBoolean instances created: "
+ << theStylesheetXObjectFactory.getTotalBooleanInstanceCount()
+ << endl
+ << "Total number of XNodeSet instances created: "
+ << theStylesheetXObjectFactory.getTotalNodeSetInstanceCount()
+ << endl
+ << "Total number of XNull instances created: "
+ << theStylesheetXObjectFactory.getTotalNullInstanceCount()
+ << endl
+ << "Total number of XNumber instances created: "
+ << theStylesheetXObjectFactory.getTotalNumberInstanceCount()
+ << endl
+ << "Total number of XResultTreeFrag instances created: "
+ << theStylesheetXObjectFactory.getTotalResultTreeFragInstanceCount()
+ << endl
+ << "Total number of XString instances created: "
+ << theStylesheetXObjectFactory.getTotalStringInstanceCount()
+ << endl
+ << "Total number of XUnknown instances created: "
+ << theStylesheetXObjectFactory.getTotalUnknownInstanceCount()
+ << endl
+ << endl
+ << "Stylesheet XPath details:"
+ << endl
+ << endl
+ << "Total number of XPath instances created: "
+ << theStylesheetXPathFactory.getTotalInstanceCount()
+ << endl
+ << endl;
+ }
+#endif
+
+ theExecutionContext.reset();
+
+ theConstructionContext.reset();
+ theStylesheetXPathFactory.reset();
+ theStylesheetXObjectFactory.reset();
+
+ processor.reset();
+
+ theXPathFactory.reset();
+ theXObjectFactory.reset();
+ theXSLProcessorSupport.reset();
+ theXPathSupport.reset();
+
+ xmlParserLiaison.reset();
+
return 0;
}
-int main(int argc, const char* argv[]) throw()
+int
+main(
+ int argc,
+ const char* argv[])
{
/**
* Command line interface to transform the XML according to
@@ -840,7 +945,7 @@
if (!msg.empty())
cout << "Message is : " << msg << endl;
- theResult = -1;
+ theResult = -2;
}
catch (XMLException& e)
{
@@ -856,7 +961,7 @@
if (!msg.empty())
cout << "Message is : " << msg << endl;
- theResult = -1;
+ theResult = -3;
}
catch(const XalanDOMException& e)
{
@@ -866,11 +971,13 @@
<< "."
<< endl;
- theResult = -1;
+ theResult = -4;
}
catch (...)
{
cout << "\nUnhandled Exception\n";
+
+ theResult = -5;
}
#if !defined(NDEBUG)