Hi Dave,
thanx for the hint, you are right - I am a bit unfamiliar with Unicode 
strings... But if you have a handy link for getting an intro, I would 
appreciate ;-)
I found a (fairly simple) way to get the desired char* out from XalanDOMString 
by use of a simple function and the transcode() function as you suggested:

char* f( std::vector<char>& v ) 
{
        char* pc = &v[0];
        return pc;                                                       
};

std::vector<char> Sout = theResult->str().transcode();
char* x = f(Sout);
printf("\n...Evaluating the Result-Vector[0] x: %f\n", x);

Bye, Ingo



-----Urspr�ngliche Nachricht-----
Von: David N Bertoni/Cambridge/IBM [mailto:[EMAIL PROTECTED]
Gesendet am: Donnerstag, 12. Dezember 2002 17:37
An: [email protected]
Betreff: Re: WG: cast Problem: from XalanDOMString to char* ???

Hi Ingo,

Look at XalanDOMString::transcode() or the function
TranscodeToLocalCodePage().

Also, if you have a modern STL implementation on your platform, you may be
able to wcout instead of cout out, if you just want to display the string.

> Trying out the XPathAPI samples I found it quite hard (in fact
impossible)
> to get theResult of an XPath evaluation handed over to a char variable
when
> I want to work on with this.

It may be difficult, if you're unfamiliar with Unicode strings, but not
impossible.

Dave



                                                                                
                                                           
                      "Wolf, I"                                                 
                                                           
                      <[EMAIL PROTECTED]         To:      
[email protected]                                                    
   
                      .com>                    cc:      (bcc: David N 
Bertoni/Cambridge/IBM)                                               
                                               Subject: WG: cast Problem: from 
XalanDOMString to char* ???                                 
                      12/12/2002 05:16                                          
                                                           
                      AM                                                        
                                                           
                                                                                
                                                           



> Hello,
> I am a newbee to this list and Xalan for C++. Trying out the XPathAPI
samples I found it quite hard (in fact impossible) to get theResult of an
XPath evaluation handed over to a char variable when I want to work on with
this.
> Is there a way to get the string-content out of the XObjectPtr or XObject
or const XalanDOMString ???
> I assumed this would work the following way in the sample SimpleXPathAPI,
but it doesn't:
>
>                                                            // OK, let's
evaluate the expression...
>                                                            const
XObjectPtr         theResult(
>
theEvaluator.evaluate(
>
                   theDOMSupport,
>
                   theContextNode,
>
                   XalanDOMString(xPathString).c_str(),
>
                   theDocument->getDocumentElement()));
>
>
assert(theResult.null() == false);
>
>                                                            cout << "The
string value of the result is:"
>
<< endl
>
<< theResult->str()    //at this Point I have a XalanDOMString, but
char test = (theResult->str()).c_str    is not possible
>
<< endl;
>
> Any comments or help would be highly appreciated.
>
> Best, Ingo
>
>
>

Reply via email to