Maybe I'm just blind, but I couldn't find out how to do the following 
(using xerces-c-src1_7_0.tar.gz):

I implement ContentHandler (SAX2), and override the "character" method. 
Now this method has the signature
void characters (const XMLCh *const chars, const unsigned int length)
i.e. it seems to get a not-null-terminated XMLCh string. I need to convert 
this string to a std::string for further processing, but I haven't got 
the slightest idea how to do that.

XMLString::transcode() & co only work on null-terminated XMLCh strings. 
Bad. Going over XMLString::CopyNString () could be possible, but 
according to the description it awaits a null-terminated string as well, 
so using it for some random, unterminated snippet is IMHO unsafe.

Looking at samples/SAX2Print/ it seems that a possible way is to implement 
XMLFormatTarget::writeChars () [undocumented], pass it to 
XMLFormatter::formatBuf () [undocumented] and let it construct a 
std::string by casting the XMLByte* parameter to char * . Which is ugly 
and unsafe.

So - Is there a simple solution for this problem?


PS: I looked through the mail archives, back to 2002-05-01 and didn't find 
anything.

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

REALITY.SYS corrupted ... reboot Universe [Y,n]?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to