Thanks Will - I was working backwards through the messages and I have just started look at your code. I think it will help with what I am doing. Thanks!
Jonathan -----Original Message----- From: Will Sappington [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 9:10 AM To: xalan-c-users@xml.apache.org Subject: RE: Tangled strings Converting the XalanDOMString to a C++ STL string is what the class I sent you does, although subject to the limitations that Dave describes below, i.e. it transcodes to the local code page. The XalanDomCString class I posted is just a wrapper for the code that does the conversion from XalanDOMString to to C++ STL string. The internal representation of the string inside the class is an STL (std::) string and there are methods to return a reference to it, or its c_str() pointer so you can use the XalanDomCString as if it was a C++ string. If you would rather deal with STL strings directly, just use the code in either the XalanDOMString constructor or the .assign() method wherever you need to do a conversion. -will -----Original Message----- From: Coker, Jonathan M [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 9:49 AM To: xalan-c-users@xml.apache.org Subject: RE: Tangled strings Sorry - I am still stumbling over some of the terminology. Inside of one of my functions I call getNodeValue() and it returns a XalanDOMString. My function is returning an STL string (reference or pointer). I am trying to convert that XalanDOMString to a C++ STL string. With Xerces I was using the static 'transcode' methods in XMLString and I was trying to find something similar for a Xalan string. Jonathan -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 3:55 PM To: xalan-c-users@xml.apache.org Subject: Re: Tangled strings Coker, Jonathan M wrote: > Hello, > Thanks to David and Will for the help with moving the parser into a > class. I have that working so I am moving on to more involved > development. I am currently stumbling over the extraction of a C++ > string from XalanDOMString after a call to XalanNode::getNodeValue(). > I am getting the the XalanDOMString but my attempts to transcode (like > I did in Xerces) have failed. I have not gone through all of the API > documents but I am hoping that I have just missed something simple. Without more details about what "transcode" means, and what "failed" means, it's hard to say what might have gone wrong. Often, "transcoding" means transcoding to the local code page. That's what you get when you use XMLString::transcode() and XalanDOMString::transcode(). That will fail if the UTF-16 string contains a Unicode code point that's not representable in the local code page. If that's the case, you need to decide what to do, because you cannot maintain the fidelity of the data in the local code page. Other times, "transcoding" means transcoding to UTF-8, because you want a character string that is compatible with C/C++ run-time library functions, or some other API that accepts such strings. In that case, you should create a UTF-8 transcoder through Xerces-C and use that to transcode the data. Dave