用msxml生成xml文件时,第一次生成很正常,第二次生成的时候出现错误,弹出对话框: RunTime Error!
This application has requested the RunTime to terminate it in an unusual way.
Please contact the application's support them for more information关键代码如下:
m_pXmlRoot = m_pDom->createElement(_T("Param"));//根节点
m_pDom->appendChild(m_pXmlRoot); m_pXmlRoot->Release();
m_pXmlRoot = NULL;第二次运行到m_pDom->createElement(_T("Param"));时调用了
inline void __cdecl CTrace::TraceV(const char *pszFileName, int nLine,
DWORD_PTR dwCategory, UINT nLevel, LPCWSTR pszFmt, va_list args) const
{
AtlTraceVU(m_dwModule, pszFileName, nLine, dwCategory, nLevel, pszFmt, args);
}
出错!
怎么处理啊!
啥原因出的错?
strXml = (LPCSTR)m_pDom->Getxml();
给发出去了
即:
if (m_pDom)
{
m_pDom->Release();
}
刚才的问题解决了,这是你所说的,我在生成strXml 后调用
m_pDom->removeChild(m_pXmlRoot);
就没有错了。
不过在析构中这句话有错,啥原因??
应该是
m_pDom.Release();但是我不找到为什么应该是用 . 而不是 -> 呢?m_pDom为 IXMLDOMDocumentPtr 类型的