Hi, > I've written some code which use Xerces 2.4.0 and to make it easy I write a > method that transcode (using XMLString static method) every XMLCh* to > std:string.
There are some macros in the samples that do this as well. > Just because it's easiest to use std::string for manipulation, comparison, > allocation, ... Take a look at XMLString for manipulation and comparison. Transcoding to std::string is not very safe to perform these operations. Also, take a look at the documents methods for allocation. Xerces can do this for you. > But now I discover my XML was containing UNICODE character and when I > transcode it to std::string, I lost these character. :o(d > They simply dissapeared , certainly because they are not in the local code > page (If I well understand :o)). If characters exist in your XMLCh* that are not available in your local code page then this will happen. I prefer not to think of it as a certain character in your XMLCh* was unicode, but rather they all are. It just happens that some map to your local code page. > Is the only solution to use only XMLCh* string and lose the powerfull using > of std::string ? You describe a possible solution below, but that will involve a more heavy weight approach of having a wrapping object. We have decided against this and provide static methods in XMLString. > Maybe the best way, is to write a class which encapsulate XMLCh* and > provide the same interface as std::string... > If I remember when I was using Xerces 1.6, no Serializer was provided with > and everybody was writing its own serializer... Is it the same for > this encapsultation of XMLCh* string??? The serializer everyone used to write was for the XML. If you want to serialize XMLCh and view you either need an editor that will understand UTF8/16 or transcode to your local code page. These facilities are all available via transcode. You have already seen you can lose information by transcoding to your local code page. Gareth -- Gareth Reakes, Managing Director +44-1865-811184 Parthenon Computing http://www.parthcomp.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]