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