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