You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Fred Preston <PR...@uk.ibm.com> on 2006/05/08 11:33:33 UTC

Re: Conversion fault

Hi Magnus,
        xsd__string is simply a char *.  To convert from one to the other 
do the following:-

xsd__string     pXSD_String = "Test";
std::string     sString;

// Converting from xsd__string to std::string
// Because the string class has overridden the '=' operator, you can 
simply assign an xsd__string to a string.

sString = pXSD_String;

// Converting from std::string to xsd__string.
// The c_str() method converts the contents of the string object to a 
const char *.  This can then be assigned to the xsd__string variable.

pXSD_String = (char *) sString.c_str();

Regards,

Fred Preston.




"Magnus Karlsson" <ma...@home.se> 
08/05/2006 09:35
Please respond to
"Apache AXIS C User List" <ax...@ws.apache.org>


To
axis-c-user@ws.apache.org
cc

Subject
Conversion fault






I'm using Axis C++ 1.6b for Windows (XP Professional). I'd like to know 
how conversion is done from std::string to axiscpp::xsd__string? I want to 
use ordinary string management (std::string) but when I try to cast an 
std::string to axiscpp::xsd__string I get "error C240: 'type cast' : 
cannot convert from 'std:string' to 'axiscpp::xsd_string'. Would it be 
better to skip xsd__strings and not use them at all?
 
Best regards
Magnus