On Tue, 2004-08-17 at 23:14, Heeg, Michael wrote: > Hi everybody, > > I am getting crazy about a (small?) problem. I have created a class > "MyClass" which contains a method called "DOMCreateNewDOMDocument" (see code > extract below). This method should create a new DOMDocument, which can be > processed. The method works fine when called the first time, but the second > call leads to a crash when executing the "xchImpl = > XMLString::transcode("Range");" command. > > Do I have to delete or reset the DOMDocument or the DOMImplementation after > the first usage? > Can anybody help me???? > > Regards, > Michael > > > > bool MyClass::DOMCreateNewDOMDocument( DOMDocument* &pDomDoc, > > TMM_String strRootNodeName, > > TMM_String strXSLTReference, > > CStringArray &straNamespacePrefixes, > > CStringArray &straNamespaceURIs, > > TMM_String strSchemaPath, > > TMM_Bool bUseNamespace, > > TMM_Bool bAddDefaultXSINamespace) > { > TMM_Bool bResult; > TMM_String strTemp; > > //create new DOM implementation > XMLCh* xchImpl; > //fixme > xchImpl = XMLString::transcode("Range"); > //fixme > DOMImplementation* impl = > DOMImplementationRegistry::getDOMImplementation(xchImpl); > .... > .... > return bResult; > }
Hi Michael, I'm no xerces expert but, as no-one else has spoken up, here's my 2 cents. I think it unlikely that the problem is in XMLString::transcode. The XMLString class is reasonably simple (even including the transcoding stuff). And it has no relation whatsoever to the existence or otherwise of any DOMDocument or DOMImplementation objects AFAIK. Maybe you have a bug that is causing some kind of memory overwrite between the two calls to your DOMCreateNewDOMDocument method? By the way, are you sure you're calling XMLPlatformUtils::Initialize before you use any xerces functionality? NB: I believe you have a memory leak in your code. XMLString::transcode returns an allocated buffer that the caller must deallocate using delete[] or XMLString::release. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]