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. Obtaining MSXML interfacte

Obtaining MSXML interfacte

Scheduled Pinned Locked Moved XML / XSL
questionc++xml
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.
  • K Offline
    K Offline
    koumodaki
    wrote on last edited by
    #1

    I am new to MSXML. I am using xml interface to read a xml file in a C++ program. The code is #include "fstream.h" #include "string.h" #import "msxml2.dll" named_guids raw_interfaces_only using namespace MSXML2; using namespace std; void main() { IXMLDOMDocumentPtr m_pXmlDoc; IXMLDOMNodePtr m_pProductNode; HRESULT hr = m_pXmlDoc.CreateInstance(MSXML2::CLSID_DOMDocument); _variant_t vtFileName("my_xml.xml"); VARIANT_BOOL vtRetVal; m_pXmlDoc->load(vtFileName,&vtRetVal); } The program gives an exception when I load the file. On Debugging I found that the m_pXmlDoc is NULL. Why am I not get the instance? What is wrong in this piece of code?

    M 1 Reply Last reply
    0
    • K koumodaki

      I am new to MSXML. I am using xml interface to read a xml file in a C++ program. The code is #include "fstream.h" #include "string.h" #import "msxml2.dll" named_guids raw_interfaces_only using namespace MSXML2; using namespace std; void main() { IXMLDOMDocumentPtr m_pXmlDoc; IXMLDOMNodePtr m_pProductNode; HRESULT hr = m_pXmlDoc.CreateInstance(MSXML2::CLSID_DOMDocument); _variant_t vtFileName("my_xml.xml"); VARIANT_BOOL vtRetVal; m_pXmlDoc->load(vtFileName,&vtRetVal); } The program gives an exception when I load the file. On Debugging I found that the m_pXmlDoc is NULL. Why am I not get the instance? What is wrong in this piece of code?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You're not checking the return value from CreateInstance(). What is it returning?

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Hungarian notation FTW

      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