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 David N Bertoni/Cambridge/IBM <da...@us.ibm.com> on 2002/12/12 17:37:09 UTC

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"                                                                                                            
                      <WolfI@t-systems         To:      xalan-c-users@xml.apache.org                                                       
                      .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
>
>
>