I have spent several hours trying to figure out why I can't 'release' my domDoc. Hoping someone can give me some direction. I am a novice with XML.
I am running on Windows 2000 using VC++6 and xerces2.5 with schema generated code from XMLSpy. Here is the significant code: //************************************************ //Delete the XERCES objects created during the call to parseXMLbuffer. //************************************************ void parseXMLbufferDelete(CNode *pNode) { static char *funcName="parseXMLbufferDelete"; poIt = parserObjs.begin(); while (poIt->node0 != pNode && poIt != parserObjs.end()) { poIt++; } if (poIt != parserObjs.end()) { //Note: Tried reverse order and still does not work. // delete poIt->xercesInputSource0; //check poIt->domSource0->release(); //check xercesc::XMLString::release(&poIt->bfrId0); //check //NOTE: Leaking about 70 bytes per message w/o the release. // //@@@@@ CRASHING HERE @@@@@ // poIt->domBuilder0->release(); //checked; will not work //poIt->domDoc0->release(); //checked; will not work parserObjs.erase(poIt); } else { cout << "...parserObjs end found." << endl; } } //************************************************ //************************************************ CNode* parseXMLbuffer( SchemaEnum schemaEn, CDoc & doc, const char * data, int dataLen) { static char *funcName = "parseXMLbuffer"; static ushort msgCt = msgCt + 1; ParserObjectsT po; memset(&po, 0, sizeof(po)); //Create a Document object based on the type of XML message. // try { //Create a Document object based on the type of XML message. // //xx doc0 = (CDoc*)createSchemaObject(schemaEn); //---------------------------------------------------------------------- ----------------------------- // The following lines including the line containing // "domBuilder->parse" are required to generate a DOM document // from the InformationObject received through the subscription. // Apparently the XMLSPY generated data structure can be loaded // by simply constructing the root object from a DOM document. // This was done because altova::CDoc doesn't provide a Load // method that takes a memory buffer as input. The only Load // method provided takes a URI as input. // See the implementation of altova::CDoc::Load. po.bfrId0 = xercesc::XMLString::transcode(tdl::itoa(msgCt)); // Load buffer into an object supporting the SAX InputSource // interface po.xercesInputSource0 = new xercesc::MemBufInputSource ( (Byte*)data, dataLen, po.bfrId0 ); // Wrap the object supporting the SAX InputSource interface // with an object supporting the DOMInputSource interface po.domSource0 = new xercesc::Wrapper4InputSource(po.xercesInputSource0, false); po.domBuilder0 = doc.GetBuilder(); // Parse the received XML message and create a DOMDocument. // Then, load the XMLSPY generated data structure. po.domDoc0 = po.domBuilder0->parse(*po.domSource0); //RETURN VARIABLE // po.node0 = (CNode*)createSchemaObject(schemaEn, po.domDoc0); parserObjs.push_back(po); } catch (StreamClosedException* /* sce */) { //cout << "Stream Closed!" << endl; } catch (Exception *ex) { ex->printStackTrace(); } return po.node0; } //end parseXMLbuffer() Thanks in advance, Brent --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]