Sven Bauhan wrote:
Hi Javi,
the Xerces interface is not really intuitively. A short description can be
found at the DOM programming giude:
http://xerces.apache.org/xerces-c/program.html
In the Xerces documentation it is often described to use an extra class for
the conversion of std::string and XMLChar*. I have written such a class. As
it is quite short, I attach it here.
Your class uses XMLString::transcode(), which transcodes to the local code
page. This will result in data loss in cases where content contains
Unicode characters that are not representable in the local code page. A
better choice would be to transcode to UTF-8, which is compatible with
char* APIs, and has the advantage that it can represent any Unicode character.
There are many postings in the archives that will illustrate why using
XMLString::transcode() is a bad idea. I wish we would actually modify the
analogous class in our samples so it doesn't do local code page
transcoding, as it's providing a bad example.
Dave