I'm using the XMLDOM methodology to parse a XML file using visual c++....
I do something like this:
#import "msxml4.dll"
using namespace MSXML2;
inline void EVAL_HR( HRESULT _hr )
{ if FAILED(_hr) throw(_hr); }
Then I begin to load the xml document into the XMLDOM objects like so...
IXMLDOMDocument2Ptr m_pXMLDOM ;
IXMLDOMElementPtr m_pRootElem ;
m_pXMLDOM = NULL ;
m_pRootElem = NULL ;
EVAL_HR( m_pXMLDOM.CreateInstance("Msxml2.DOMDocument.4.0"
) ;
m_pXMLDOM->async = false;
if (!m_pXMLDOM->load((LPCTSTR)cstrXMLFileName))
{
CString cstrErrorMessage ;
AfxMessageBox("3"
;
cstrErrorMessage.Format (" %s\n\nerror=%d\nurl=%s\ntext=%s\nline=%d\npos=%d\n
filepos=%d",
(LPCTSTR)m_pXMLDOM->parseError->Getreason(),
m_pXMLDOM->parseError->errorCode,
(LPCTSTR)m_pXMLDOM->parseError->url,
(LPCTSTR)m_pXMLDOM->parseError->srcText,
m_pXMLDOM->parseError->line,
m_pXMLDOM->parseError->linepos,
m_pXMLDOM->parseError->filepos) ;
AfxMessageBox (cstrErrorMessage) ;
AfxThrowUserException( );
} ;
EVAL_HR(m_pXMLDOM->get_documentElement(&m_pRootElem) );
When I debug... the application crashes on the
EVAL_HR( m_pXMLDOM.CreateInstance("Msxml2.DOMDocument.4.0"
) ;
line. The debugger gives me the following exception:
UNHANDLED EXCEPTION
KERNEL32.DLL 0xE06D7363
Any ideas? The strange part is that replicate code works in a different class of the same project... I've double checked and the code is exactly the same.
I do something like this:
#import "msxml4.dll"
using namespace MSXML2;
inline void EVAL_HR( HRESULT _hr )
{ if FAILED(_hr) throw(_hr); }
Then I begin to load the xml document into the XMLDOM objects like so...
IXMLDOMDocument2Ptr m_pXMLDOM ;
IXMLDOMElementPtr m_pRootElem ;
m_pXMLDOM = NULL ;
m_pRootElem = NULL ;
EVAL_HR( m_pXMLDOM.CreateInstance("Msxml2.DOMDocument.4.0"
m_pXMLDOM->async = false;
if (!m_pXMLDOM->load((LPCTSTR)cstrXMLFileName))
{
CString cstrErrorMessage ;
AfxMessageBox("3"
cstrErrorMessage.Format (" %s\n\nerror=%d\nurl=%s\ntext=%s\nline=%d\npos=%d\n
filepos=%d",
(LPCTSTR)m_pXMLDOM->parseError->Getreason(),
m_pXMLDOM->parseError->errorCode,
(LPCTSTR)m_pXMLDOM->parseError->url,
(LPCTSTR)m_pXMLDOM->parseError->srcText,
m_pXMLDOM->parseError->line,
m_pXMLDOM->parseError->linepos,
m_pXMLDOM->parseError->filepos) ;
AfxMessageBox (cstrErrorMessage) ;
AfxThrowUserException( );
} ;
EVAL_HR(m_pXMLDOM->get_documentElement(&m_pRootElem) );
When I debug... the application crashes on the
EVAL_HR( m_pXMLDOM.CreateInstance("Msxml2.DOMDocument.4.0"
line. The debugger gives me the following exception:
UNHANDLED EXCEPTION
KERNEL32.DLL 0xE06D7363
Any ideas? The strange part is that replicate code works in a different class of the same project... I've double checked and the code is exactly the same.