You should wrap your use of transcode into a function that returns either an STL 
string (for 1-byte chars) or DOMString (for Unicode).  That makes it leak proof 
and exception safe.

See http://www.goingware.com/tips/xmlmemory.html

note that when handling memory allocated with new, you should normally use 
auto_ptr to handle it, or Boost's shared_ptr (to be able to handle it in an STL 
container - http://www.boost.org/ ), or ZooLib's ZRef (a thread-safe reference 
counted smart pointer: http://zoolib.sourceforge.net/ ) but none of these work 
for arrays, something I discuss in the page above.  The problem is that you need 
to delete with delete [] rather than plain delete.

Xerces itself provides the ArrayJanitor for this sort of thing.

Mike
-- 
Michael D. Crawford
GoingWare Inc. - Expert Software Development and Consulting
http://www.goingware.com
[EMAIL PROTECTED]

   Tilting at Windmills for a Better Tomorrow.

     "I give you this one rule of conduct. Do what you will, but speak
      out always. Be shunned, be hated, be ridiculed, be scared,
      be in doubt, but don't be gagged."
      -- John J. Chapman, "Make a Bonfire of Your Reputations"
         http://www.goingware.com/reputation/


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

Reply via email to