郭明 wrote:
> hello,i am a chinese instersted in XersecC!
>
> I had writen a class for transform the XMLCh char to Local encoding
>
> develop env : Linux 2.4.20-28.7smp
> xerces version : xerces c++ 2.6
> compiler : GNU g++
>
> i find in the class StrTransformer.cpp, when it's destructor like
> this, the process got Segmentation fault (core dumped)!
> StrTransformer::~StrTransformer()
> {
>  delete target;
>  delete format;
> }

Hi 郭明,

transformation between xerces-internal string representation (XMLCh) and 
local string representation (char) is done via XMLString::transcode(.).

XMLString::transcode returns a string (either XMLCh* or char*, depending 
on the trancoding direction) that has to be released by the application 
after use. The release method of choice is XMLString::release(.).

So, a typical scenario looks like this:

Given a const XMLCh *xml_string:

char *local_representation = XMLString::transcode(xml_string);
if (local_representation){
        // use local_representation
        XMLString::release(&local_representation);
}

You don't need to call any destructor explicitly.

BTW: which transcoder do you use for chinese transcoding: iconv or icu?

Cheers,
                        Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **

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

Reply via email to