Here is a code fragment, that works well on my system, from my MSVC code
that converts a nodes value to a MFC CString:

char* pValue = XMLString::transcode( pNode->getNodeValue() );
CString Value = pValue;
delete pValue;

Conversion is done by a XMLLCPTranscoder* which is initialised by a calling
XMLPlatformUtils::Initialize() from your calling app. Therefore the memory
is allocated by your app, not the dll.

I Hope this helps you

Gert van Spijker

> I am a little unclear on how this is supposed to work. In fact
> this crashes on me all the time.
>
> ostream& operator<< (ostream& target, const DOMString& s)
> {
>     char *p = s.transcode();
>     target << p;
>     delete [] p;
>     return target;
> }
>
> If the memory is allocated within a different heap (I am using the dll
> supplied for windows) how can the user delete it? It specifically says in
> the documentation that the user is supposed to delete the memory that is
> allocated by transcode. Am I using this function wrong? If not then how
can
> I get a char* out of DOMString without memory leaks?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to