Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How to catch an exception thrown by MSXML? [modified]

How to catch an exception thrown by MSXML? [modified]

Scheduled Pinned Locked Moved XML / XSL
questiontutorialannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JoeSchmoe007
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • J JoeSchmoe007

      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

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      #import generated ATL code throws _com_error exceptions When all else fails, consult the documentation[^]

      led mike

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups