How to catch an exception thrown by MSXML? [modified]
-
Consider this function: BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const CString &strPath, CString &StrValue) { BOOL bRetCode=FALSE; BSTR bstrQstr = strPath.AllocSysString(); IXMLDOMNodePtr o; o = pXMLDoc->selectSingleNode( bstrQstr); if (o!=NULL) { HRESULT hr=o->get_text(&bstrQstr); if (hr==S_OK) { StrValue = bstrQstr; bRetCode = TRUE; } else { StrValue=""; } } //o->Release(); SysFreeString(bstrQstr); return bRetCode; } Call to selectSingleNode() sometimes works as expected but sometimes it throws an exception. How can I extract additional information about this exception?
modified on Tuesday, September 30, 2008 1:52 PM
-
Consider this function: BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const CString &strPath, CString &StrValue) { BOOL bRetCode=FALSE; BSTR bstrQstr = strPath.AllocSysString(); IXMLDOMNodePtr o; o = pXMLDoc->selectSingleNode( bstrQstr); if (o!=NULL) { HRESULT hr=o->get_text(&bstrQstr); if (hr==S_OK) { StrValue = bstrQstr; bRetCode = TRUE; } else { StrValue=""; } } //o->Release(); SysFreeString(bstrQstr); return bRetCode; } Call to selectSingleNode() sometimes works as expected but sometimes it throws an exception. How can I extract additional information about this exception?
modified on Tuesday, September 30, 2008 1:52 PM