Altova Mailing List Archives


IXMLDOMDocumentPtr crash on second run

From: rsympkins@-------.---.-- (--- --------)
To: NULL
Date: 4/27/2004 5:39:00 PM
Hi

I have the following code in a container class to begin an XML
document:

    if (bOk != FALSE)
    {
        m_strXmlFilePath = strXmlFilePath;
        m_pDoc = MSXML::IXMLDOMDocumentPtr(MSXML::CLSID_DOMDocument);
        bOk = (m_pDoc != NULL);
    }

Once I have added all my nodes/items, i then save ('end') it with the
following code:

    if (bOk != FALSE)
    {
        bOk = SUCCEEDED(m_pDoc->save(_variant_t(m_strXmlFilePath)));
    }

This works fine for the first time it is used in the application. 
Also, xml documents are happily created and saved if my container
class is used within the same scope. ie the following works fine.

void func(void)
{
   CXMLContainer oXml;
   oXml.begin("test1.xml");
   oXml.end();

   oXml.begin("test2.xml");
   oXml.end();
}

However the above code is contained in a CDialog derived class. So for
first run of the dialog, it works fine, but on the second run it
crashes on the call to
MSXML::IXMLDOMDocumentPtr(MSXML::CLSID_DOMDocument).

Can someone see what I am doing wrong and point me in the right
direction?

Regards,
Rex

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.