You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by gu...@wipro.com on 2006/01/18 12:12:27 UTC

RE: Transcode issue with XALAN 1.9

		All,

		I had upgraded XALAN 1.7 to 1.9 on HP UNIX machine
today. After upgrading, I am getting the following compilation error.
Can any one help me on this?

		Source code is as follows

		    // OK, let's evaluate the expression...
		    XObjectPtr theResult( theEvaluator.evaluate(
theDOMSupport,
		                        theContextNode,

XalanDOMString(expression.c_str()).c_str(),
		                        thePrefixResolver));

		    XPathEvaluator::terminate();

		    vector <char> charData;
		    charData = theResult->str().transcode();
		    returnVal.assign(charData.begin(), charData.end());

		Following is the error.
		Error 181: "XMResponseParser.cc", line 195 # Expected 1
argument(s) for "void
xalanc_1_9::XalanDOMString::transcode(xalanc_1_9::XalanVector<char,xalan
c_1_9::MemoryManagedConstructionTraits<char> > &) const"; had 0 instead.
		        charData = theResult->str().transcode();
		                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^


		Thanks,
		Guru Murthy,
		WIPRO Technologies,
		Ph: 080 3029 28 28
		M: 9845763762
		WIPRO VOIP: 808 4445




The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Transcode issue with XALAN 1.9

Posted by David Bertoni <db...@apache.org>.
guru.murthy@wipro.com wrote:
>             All,
> 
>             I had upgraded XALAN 1.7 to 1.9 on HP UNIX machine today.
>             After upgrading, I am getting the following compilation
>             error. Can any one help me on this?
> 
>             *Source code is as follows*
> 
>                 // OK, let's evaluate the expression...
> 
>                 XObjectPtr theResult( theEvaluator.evaluate( theDOMSupport,
> 
>                                     theContextNode,
> 
>                                    
>             XalanDOMString(expression.c_str()).c_str(),
> 
>                                     thePrefixResolver));
> 
>                 XPathEvaluator::terminate();
> 
>                 vector <char> charData;
> 
>                 charData = theResult->str().transcode();
> 
>                 returnVal.assign(charData.begin(), charData.end());
> 
>             *Following is the error.*
> 
>             Error 181: "XMResponseParser.cc", line 195 # Expected 1
>             argument(s) for "void
>             xalanc_1_9::XalanDOMString::transcode(xalanc_1_9::XalanVector<char,xalanc_1_9::MemoryManagedConstructionTraits<char>
>              > &) const"; had 0 instead.
> 
>                     charData = theResult->str().transcode();
> 
>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When we implemented pluggable memory management, we had to make changes 
to functions that returned objects by value.  So, instead of returning 
then by value, the functions expect the argument as the first parameter. 
  Also, we moved from using the containers in the standard library to a 
set of custom containers.

Your code can be re-written as follows:


// OK, let's evaluate the expression...

     XObjectPtr theResult( theEvaluator.evaluate( theDOMSupport,

                                      theContextNode,


     XalanDOMString(expression.c_str()).c_str(),

                                      thePrefixResolver));

     XPathEvaluator::terminate();

     XalanVector<char> charData;

     theResult->str().transcode(charData);

     returnVal.assign(charData.begin(), charData.end());

Note that it's a very bad idea to XPathEvaluator::terminate() the way 
you're doing it.  You should call XPathEvaluator::initialize() at the 
same place you XMLPlatformUtils::Initialize() and 
XalanTransformer::initialize(), and call XPathEvaluator::terminate() the 
same place you call the other terminate functions.

Dave