dbertoni 2002/11/25 18:28:01
Modified: c/samples/CompileStylesheet CompileStylesheet.cpp
c/samples/DocumentBuilder DocumentBuilder.cpp
c/samples/ExternalFunction ExternalFunction.cpp
c/samples/ParsedSourceWrappers ParsedSourceWrappers.cpp
c/samples/SerializeNodeSet SerializeNodeSet.cpp
c/samples/SimpleTransform SimpleTransform.cpp
c/samples/SimpleXPathAPI SimpleXPathAPI.cpp
c/samples/StreamTransform StreamTransform.cpp
Log:
Updates for C++ namespace support.
Revision Changes Path
1.23 +8 -6
xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp
Index: CompileStylesheet.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- CompileStylesheet.cpp 14 Nov 2002 23:54:15 -0000 1.22
+++ CompileStylesheet.cpp 26 Nov 2002 02:27:59 -0000 1.23
@@ -32,12 +32,9 @@
int argc,
const char* /* argv */[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::endl;
- using std::ifstream;
- using std::ostrstream;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(endl)
+ XALAN_USING_STD(ostrstream)
int theResult = 0;
@@ -49,6 +46,11 @@
}
else
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XalanTransformer)
+ XALAN_USING_XALAN(XalanCompiledStylesheet)
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
1.7 +28 -12 xml-xalan/c/samples/DocumentBuilder/DocumentBuilder.cpp
Index: DocumentBuilder.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/DocumentBuilder/DocumentBuilder.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DocumentBuilder.cpp 14 Nov 2002 23:54:15 -0000 1.6
+++ DocumentBuilder.cpp 26 Nov 2002 02:28:00 -0000 1.7
@@ -25,9 +25,21 @@
+XALAN_USING_XALAN(XalanDocumentBuilder)
+XALAN_USING_XALAN(XalanTransformer)
+
+
+
void
BuildDocument(XalanDocumentBuilder* theBuilder)
{
+ XALAN_USING_XERCES(ContentHandler)
+ XALAN_USING_XALAN(AttributesImpl)
+ XALAN_USING_XALAN(XalanDOMChar)
+ XALAN_USING_XALAN(XalanDOMString)
+ XALAN_USING_XALAN(c_wstr)
+ XALAN_USING_XALAN(length)
+
// Get the SAX2 ContentHandler from the builder...
ContentHandler* const theContentHandler =
theBuilder->getContentHandler();
assert(theContentHandler != 0);
@@ -47,55 +59,57 @@
theContentHandler->startDocument();
// start the document element...
- assign(theElementName, XALAN_STATIC_UCODE_STRING("foo"));
+ theElementName = XALAN_STATIC_UCODE_STRING("foo");
theContentHandler->startElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName), theAttributes);
// Create an element child...
// Set the name of the element...
- assign(theElementName, XALAN_STATIC_UCODE_STRING("foobar"));
+ theElementName = XALAN_STATIC_UCODE_STRING("foobar");
// Add an attribute...
- assign(theAttributeName, XALAN_STATIC_UCODE_STRING("attribute1"));
- assign(theAttributeValue, XALAN_STATIC_UCODE_STRING("value1"));
+ theAttributeName = XALAN_STATIC_UCODE_STRING("attribute1");
+ theAttributeValue = XALAN_STATIC_UCODE_STRING("value1");
+
theAttributes.addAttribute(c_wstr(theAttributeName),
c_wstr(theAttributeType), c_wstr(theAttributeValue));
theContentHandler->startElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName), theAttributes);
// Add a text node...
- assign(theTextValue, XALAN_STATIC_UCODE_STRING("The first foobar"));
+ theTextValue = XALAN_STATIC_UCODE_STRING("The first foobar");
+
theContentHandler->characters(c_wstr(theTextValue),
length(theTextValue));
// End the element...
theContentHandler->endElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName));
theAttributes.clear();
- assign(theAttributeName, XALAN_STATIC_UCODE_STRING("attribute2"));
- assign(theAttributeValue, XALAN_STATIC_UCODE_STRING("value2"));
+ theAttributeName = XALAN_STATIC_UCODE_STRING("attribute2");
+ theAttributeValue = XALAN_STATIC_UCODE_STRING("value2");
theAttributes.addAttribute(c_wstr(theAttributeName),
c_wstr(theAttributeType), c_wstr(theAttributeValue));
theContentHandler->startElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName), theAttributes);
- assign(theTextValue, XALAN_STATIC_UCODE_STRING("The second foobar"));
+ theTextValue = XALAN_STATIC_UCODE_STRING("The second foobar");
theContentHandler->characters(c_wstr(theTextValue),
length(theTextValue));
theContentHandler->endElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName));
theAttributes.clear();
- assign(theAttributeName, XALAN_STATIC_UCODE_STRING("attribute3"));
- assign(theAttributeValue, XALAN_STATIC_UCODE_STRING("value3"));
+ theAttributeName = XALAN_STATIC_UCODE_STRING("attribute3");
+ theAttributeValue = XALAN_STATIC_UCODE_STRING("value3");
theAttributes.addAttribute(c_wstr(theAttributeName),
c_wstr(theAttributeType), c_wstr(theAttributeValue));
theContentHandler->startElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName), theAttributes);
- assign(theTextValue, XALAN_STATIC_UCODE_STRING("The third foobar"));
+ theTextValue = XALAN_STATIC_UCODE_STRING("The third foobar");
theContentHandler->characters(c_wstr(theTextValue),
length(theTextValue));
theContentHandler->endElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName));
// end the document element...
- assign(theElementName, XALAN_STATIC_UCODE_STRING("foo"));
+ theElementName = XALAN_STATIC_UCODE_STRING("foo");
theContentHandler->endElement(&theEmptyString, &theEmptyString,
c_wstr(theElementName));
@@ -125,6 +139,8 @@
}
else
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
1.27 +19 -8 xml-xalan/c/samples/ExternalFunction/ExternalFunction.cpp
Index: ExternalFunction.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/samples/ExternalFunction/ExternalFunction.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- ExternalFunction.cpp 14 Nov 2002 23:54:15 -0000 1.26
+++ ExternalFunction.cpp 26 Nov 2002 02:28:00 -0000 1.27
@@ -26,6 +26,15 @@
+XALAN_USING_XALAN(Function)
+XALAN_USING_XALAN(XPathExecutionContext)
+XALAN_USING_XALAN(XalanDOMString)
+XALAN_USING_XALAN(XalanNode)
+XALAN_USING_XALAN(StaticStringToDOMString)
+XALAN_USING_XALAN(XObjectPtr)
+
+
+
// This class defines a function that will return the square root
// of its argument.
class FunctionSquareRoot : public Function
@@ -49,7 +58,7 @@
XPathExecutionContext&
executionContext,
XalanNode*
context,
const XObjectArgVectorType& args,
- const Locator*
locator) const
+ const LocatorType*
locator) const
{
if (args.size() != 1)
{
@@ -130,7 +139,7 @@
XPathExecutionContext&
executionContext,
XalanNode*
context,
const XObjectArgVectorType& args,
- const Locator*
locator) const
+ const LocatorType*
locator) const
{
if (args.size() != 1)
{
@@ -211,7 +220,7 @@
XPathExecutionContext&
executionContext,
XalanNode*
context,
const XObjectArgVectorType& args,
- const Locator*
locator) const
+ const LocatorType*
locator) const
{
if (args.size() != 0)
{
@@ -287,10 +296,8 @@
int argc,
const char* /* argv */[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::endl;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(endl)
int theResult = 0;
@@ -302,6 +309,10 @@
}
else
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XalanTransformer)
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
@@ -310,7 +321,7 @@
{
// Create a XalanTransformer.
- XalanTransformer theXalanTransformer;
+ XalanTransformer theXalanTransformer;
// The namespace for our functions...
const XalanDOMString
theNamespace("http://ExternalFunction.xalan-c++.xml.apache.org");
1.7 +31 -5
xml-xalan/c/samples/ParsedSourceWrappers/ParsedSourceWrappers.cpp
Index: ParsedSourceWrappers.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/samples/ParsedSourceWrappers/ParsedSourceWrappers.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ParsedSourceWrappers.cpp 17 Nov 2002 00:49:46 -0000 1.6
+++ ParsedSourceWrappers.cpp 26 Nov 2002 02:28:00 -0000 1.7
@@ -98,6 +98,14 @@
+XALAN_USING_XALAN(XalanCompiledStylesheet)
+XALAN_USING_XALAN(XalanDOMString)
+XALAN_USING_XALAN(XalanTransformer)
+XALAN_USING_XALAN(XSLTInputSource)
+XALAN_USING_XALAN(XSLTResultTarget)
+
+
+
int
transformXercesDOM(
XalanTransformer&
theTransformer,
@@ -105,6 +113,13 @@
const XalanCompiledStylesheet* theStylesheet,
const XSLTResultTarget& theResultTarget)
{
+ XALAN_USING_XERCES(URLInputSource)
+
+ XALAN_USING_XALAN(XercesParserLiaison)
+ XALAN_USING_XALAN(XercesDOMSupport)
+ XALAN_USING_XALAN(XercesDOMWrapperParsedSource)
+
+
const URLInputSource theInputSource(theURI.c_str());
XercesParserLiaison::DOMParserType theParser;
@@ -135,6 +150,15 @@
const XalanCompiledStylesheet* theStylesheet,
const XSLTResultTarget& theResultTarget)
{
+ XALAN_USING_XERCES(URLInputSource)
+
+ XALAN_USING_XALAN(XalanDocument)
+ XALAN_USING_XALAN(XalanSourceTreeDocument)
+ XALAN_USING_XALAN(XalanSourceTreeParserLiaison)
+ XALAN_USING_XALAN(XalanSourceTreeDOMSupport)
+ XALAN_USING_XALAN(XalanSourceTreeWrapperParsedSource)
+
+
const URLInputSource theInputSource(theURI.c_str());
XalanSourceTreeParserLiaison theParserLiaison;
@@ -158,11 +182,9 @@
int
transform()
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cout;
- using std::cerr;
- using std::endl;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(cout)
+ XALAN_USING_STD(endl)
int theResult = -1;
@@ -184,6 +206,8 @@
}
else
{
+ XALAN_USING_XALAN(URISupport)
+
assert(theStylesheet != 0);
const XalanDOMString theInputFile("foo.xml");
@@ -238,6 +262,8 @@
{
try
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
1.5 +26 -6 xml-xalan/c/samples/SerializeNodeSet/SerializeNodeSet.cpp
Index: SerializeNodeSet.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/samples/SerializeNodeSet/SerializeNodeSet.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SerializeNodeSet.cpp 14 Nov 2002 23:54:15 -0000 1.4
+++ SerializeNodeSet.cpp 26 Nov 2002 02:28:01 -0000 1.5
@@ -51,11 +51,9 @@
int argc,
const char* argv[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::cout;
- using std::endl;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(cout)
+ XALAN_USING_STD(endl)
int theResult = 0;
@@ -69,11 +67,28 @@
{
try
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XPathEvaluator)
+
+
XMLPlatformUtils::Initialize();
XPathEvaluator::initialize();
{
+ XALAN_USING_XERCES(LocalFileInputSource)
+
+ XALAN_USING_XALAN(NodeRefList)
+ XALAN_USING_XALAN(XalanDocument)
+ XALAN_USING_XALAN(XalanDOMString)
+ XALAN_USING_XALAN(XalanNode)
+ XALAN_USING_XALAN(XalanSourceTreeInit)
+ XALAN_USING_XALAN(XMLSupportInit)
+ XALAN_USING_XALAN(XalanSourceTreeDOMSupport)
+ XALAN_USING_XALAN(XalanSourceTreeParserLiaison)
+
+
// Initialize the XalanSourceTree subsystem...
XalanSourceTreeInit
theSourceTreeInit;
@@ -88,7 +103,7 @@
theDOMSupport.setParserLiaison(&theLiaison);
// Create an input source that represents a
local file...
- const LocalFileInputSource
theInputSource(c_wstr(XalanDOMString(argv[1])));
+ const LocalFileInputSource
theInputSource(XalanDOMString(argv[1]).c_str());
// Parse the document...
XalanDocument* const theDocument =
@@ -138,6 +153,11 @@
}
else
{
+
XALAN_USING_XALAN(XalanStdOutputStream)
+
XALAN_USING_XALAN(XalanOutputStreamPrintWriter)
+
XALAN_USING_XALAN(FormatterToXML)
+
XALAN_USING_XALAN(FormatterTreeWalker)
+
// OK, we're going to serialize
the nodes that were
// found. We should really
check to make sure the
// root (document) has not been
selected, since we
1.19 +7 -4 xml-xalan/c/samples/SimpleTransform/SimpleTransform.cpp
Index: SimpleTransform.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/SimpleTransform/SimpleTransform.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SimpleTransform.cpp 14 Nov 2002 23:54:15 -0000 1.18
+++ SimpleTransform.cpp 26 Nov 2002 02:28:01 -0000 1.19
@@ -24,10 +24,8 @@
int argc,
const char* /* argv */[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::endl;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(endl)
int theResult = -1;
@@ -41,6 +39,11 @@
{
try
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XalanTransformer)
+
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
1.9 +19 -6 xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp
Index: SimpleXPathAPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SimpleXPathAPI.cpp 14 Nov 2002 23:54:15 -0000 1.8
+++ SimpleXPathAPI.cpp 26 Nov 2002 02:28:01 -0000 1.9
@@ -40,11 +40,9 @@
int argc,
const char* argv[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::cout;
- using std::endl;
-#endif
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(cout)
+ XALAN_USING_STD(endl)
int theResult = 0;
@@ -58,11 +56,26 @@
{
try
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XPathEvaluator)
+
+
XMLPlatformUtils::Initialize();
XPathEvaluator::initialize();
{
+ XALAN_USING_XERCES(LocalFileInputSource)
+
+ XALAN_USING_XALAN(XalanDocument)
+ XALAN_USING_XALAN(XalanDOMString)
+ XALAN_USING_XALAN(XalanNode)
+ XALAN_USING_XALAN(XalanSourceTreeInit)
+ XALAN_USING_XALAN(XalanSourceTreeDOMSupport)
+ XALAN_USING_XALAN(XalanSourceTreeParserLiaison)
+ XALAN_USING_XALAN(XObjectPtr)
+
// Initialize the XalanSourceTree subsystem...
XalanSourceTreeInit
theSourceTreeInit;
@@ -74,7 +87,7 @@
theDOMSupport.setParserLiaison(&theLiaison);
// Create an input source that represents a
local file...
- const LocalFileInputSource
theInputSource(c_wstr(XalanDOMString(argv[1])));
+ const LocalFileInputSource
theInputSource(XalanDOMString(argv[1]).c_str());
// Parse the document...
XalanDocument* const theDocument =
1.12 +17 -10 xml-xalan/c/samples/StreamTransform/StreamTransform.cpp
Index: StreamTransform.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/StreamTransform/StreamTransform.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- StreamTransform.cpp 14 Nov 2002 23:54:15 -0000 1.11
+++ StreamTransform.cpp 26 Nov 2002 02:28:01 -0000 1.12
@@ -28,17 +28,16 @@
int argc,
const char* /* argv */[])
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::cerr;
- using std::cout;
- using std::endl;
- using std::istrstream;
- using std::ofstream;
- using std::ostrstream;
+ XALAN_USING_STD(cerr)
+ XALAN_USING_STD(cout)
+ XALAN_USING_STD(endl)
+ XALAN_USING_STD(istrstream)
+ XALAN_USING_STD(ofstream)
+ XALAN_USING_STD(ostrstream)
+
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::strlen;
#endif
-#endif
int theResult = -1;
@@ -52,6 +51,11 @@
{
try
{
+ XALAN_USING_XERCES(XMLPlatformUtils)
+
+ XALAN_USING_XALAN(XalanTransformer)
+
+
// Call the static initializer for Xerces.
XMLPlatformUtils::Initialize();
@@ -96,9 +100,12 @@
istrstream theXMLStream(theInputDocument,
strlen(theInputDocument));
istrstream theXSLStream(theStylesheet,
strlen(theStylesheet));
- XSLTInputSource inputSource(&theXSLStream);
+ XALAN_USING_XALAN(XalanDOMString)
+ XALAN_USING_XALAN(XSLTInputSource)
+
+ XSLTInputSource
inputSource(&theXSLStream);
-
inputSource.setSystemId(c_wstr(XalanDOMString("foo")));
+
inputSource.setSystemId(XalanDOMString("foo").c_str());
// Do the transform.
theResult =
theXalanTransformer.transform(&theXMLStream, inputSource, cout);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]