xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/samples/XPathWrapper TestDriver.cpp XPathWrapper.cpp XPathWrapper.hpp
Date Thu, 13 Dec 2001 19:12:33 GMT
dbertoni    01/12/13 11:12:33

  Modified:    c/samples/XPathWrapper TestDriver.cpp XPathWrapper.cpp
                        XPathWrapper.hpp
  Log:
  Changes to make porting to xlC 5.02 easier.
  
  Revision  Changes    Path
  1.7       +1 -5      xml-xalan/c/samples/XPathWrapper/TestDriver.cpp
  
  Index: TestDriver.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/TestDriver.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestDriver.cpp	2001/02/15 22:12:57	1.6
  +++ TestDriver.cpp	2001/12/13 19:12:33	1.7
  @@ -60,12 +60,8 @@
   
   	try
   	{
  -		CharVectorType xmlContext, xmlPath;
  -		CopyStringToVector(argv[2], xmlContext);
  -		CopyStringToVector(argv[3], xmlPath);
  -
   		// call evaluate, passing in the XML string, the context string and the xpath string
  -		const XPathWrapper::CharVectorTypeVectorType	result = helper.evaluate(theXML, xmlContext,
xmlPath);
  +		const XPathWrapper::CharVectorTypeVectorType	result = helper.evaluate(&*theXML.begin(),
argv[2], argv[3]);
   
   		// take the resulting string vector	and do whatever you want with it:
   		size_t len = result.size();
  
  
  
  1.14      +40 -28    xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp
  
  Index: XPathWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XPathWrapper.cpp	2001/06/15 22:27:55	1.13
  +++ XPathWrapper.cpp	2001/12/13 19:12:33	1.14
  @@ -56,7 +56,6 @@
   
   
   #if !defined(XALAN_NO_NAMESPACES)
  -using std::cerr;
   using std::endl;
   using std::vector;
   #endif
  @@ -72,9 +71,14 @@
   
   	XPathWrapper::CharVectorTypeVectorType
   	evaluate(
  -		const CharVectorType&	xml, 
  -		const CharVectorType&	context, 
  -		const CharVectorType&	expr)
  +		const char*		xml,
  +		const char*		context, 
  +		const char*		expr,
  +#if defined(XALAN_NO_NAMESPACES)
  +		ostream&		errorStream)
  +#else
  +		std::ostream&	errorStream)
  +#endif
   	{
   		//initialize Xerces...
   		try
  @@ -83,7 +87,7 @@
   		}
   		catch(const XMLException&)
   		{
  -			cerr << "XMLPlatformUtils::Initialize() failed!" << endl;
  +			errorStream << "XMLPlatformUtils::Initialize() failed!" << endl;
   
   			throw;
   		}
  @@ -106,7 +110,7 @@
   			try
   			{
   				// parse XML and get root element
  -				MemBufInputSource inStream((XMLByte*)c_str(xml), xml.size(), "foo", false);
  +				MemBufInputSource inStream((XMLByte*)xml, strlen(xml), "foo", false);
   
   				XalanDocument* const	doc = theLiaison.parseXMLStream(inStream);
   				assert(doc != 0);
  @@ -116,7 +120,7 @@
   			}
   			catch(const XMLException&)
   			{
  -				cerr << "Caught XMLExecption..." << endl;
  +				errorStream << "Caught XMLExecption..." << endl;
   
   				throw;
   			}
  @@ -133,8 +137,8 @@
   				// first get the context nodeset
   				XPath* const	contextXPath = theXPathFactory.create();
   
  -				theXPathProcessor.initXPath(*contextXPath,										
  -											TranscodeFromLocalCodePage(context),
  +				theXPathProcessor.initXPath(*contextXPath,
  +											XalanDOMString(context),
   											ElementPrefixResolverProxy(rootElem, theEnvSupport, theDOMSupport));
   
   	   			XObjectPtr	xObj =
  @@ -149,25 +153,25 @@
   
   				if (theLength == 0)
   				{
  -						cerr << "Warning -- No nodes matched the location path \""
  -							 << context
  -							 << "\"."
  -							 << endl
  -							 << "Execution cannot continue..."
  -							 << endl
  -							 << endl;
  +						errorStream << "Warning -- No nodes matched the location path \""
  +									<< context
  +									<< "\"."
  +									<< endl
  +									<< "Execution cannot continue..."
  +									<< endl
  +									<< endl;
   				}
   				else
   				{
   					if (theLength > 1)
   					{
  -						cerr << "Warning -- More than one node matched the location path \""
  -							 << context
  -							 << "\"."
  -							 << endl
  -							 << "The first node matched will be used as the context node."
  -							 << endl
  -							 << endl;
  +						errorStream << "Warning -- More than one node matched the location path \""
  +									<< context
  +									<< "\"."
  +									<< endl
  +									<< "The first node matched will be used as the context node."
  +									<< endl
  +									<< endl;
   					}
   
   					// and now get the result of the primary xpath expression
  @@ -221,7 +225,7 @@
   			}
   			catch(const XMLException&)
   			{
  -				cerr << "Caught XMLExecption..." << endl;
  +				errorStream << "Caught XMLExecption..." << endl;
   
   				throw;
   			}
  @@ -255,11 +259,19 @@
   
   XPathWrapper::CharVectorTypeVectorType
   XPathWrapper::evaluate(
  -		const CharVectorType&	xml, 
  -		const CharVectorType&	context, 
  -		const CharVectorType&	path)
  +		const char*		xml, 
  +		const char*		context, 
  +		const char*		path)
   {
  -	return pImpl->evaluate(xml, context, path);
  +	return pImpl->evaluate(
  +			xml,
  +			context,
  +			path,
  +#if defined(XALAN_NO_NAMESPACES)
  +			cerr);
  +#else
  +			std::cerr);
  +#endif
   }
   
   
  
  
  
  1.6       +3 -7      xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp
  
  Index: XPathWrapper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XPathWrapper.hpp	2000/09/22 17:54:39	1.5
  +++ XPathWrapper.hpp	2001/12/13 19:12:33	1.6
  @@ -67,10 +67,6 @@
   
   
   
  -#include <XalanDOM/XalanDOMString.hpp>
  -
  -
  -
   #include <vector>
   
   
  @@ -118,9 +114,9 @@
   	// string objects
   	CharVectorTypeVectorType
   	evaluate(
  -		const CharVectorType&	xml, 
  -		const CharVectorType&	context, 
  -		const CharVectorType&	path);
  +		const char*		xml, 
  +		const char*		context, 
  +		const char*		path);
   
   private:
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message