Help with MSXML4.dll 
Author Message
 Help with MSXML4.dll

Okay, in stdafx.h I have #import "msxml4.dll"...  which seems to be working
fine, as I have access to the appropriate methods and lists involved.  The
code I'm having difficulty with is below...  at the end of the execution,
NumRaces has 0 in it and xmlNode is NULL.  Icky.  Using the de{*filter*} I can
confirm that the file is loading from the file just fine, something after
that point is going wrong.  (The xml file is well-formed and does not use a
DTD)  This isn't for anything important, I'm just trying to learn the
MSXMLDOM, but assistance would be appreciated all the same, before I tear my
own eyeballs out :)

Thanks,
-Dale

 IXMLDOMDocumentPtr docPtr;
 IXMLDOMElement* xmlRoot;
 IXMLDOMNodeList* xmlnodeRaces;
 IXMLDOMNode* xmlNode;
 long NumRaces;
 HRESULT hr;
 VARIANT_BOOL varOut;

 try{
  docPtr.CreateInstance("msxml2.domdocument");

  // load document
  CComVariant varXml("C:\\pcgen.xml");

  docPtr->put_async (false);
  docPtr->put_validateOnParse(true);
  docPtr->put_resolveExternals(true);
//  docPtr->preserveWhiteSpace=false;

  varOut = docPtr->load(varXml);

  if (varOut == FALSE)
  {
   return E_FAIL;
  }

  docPtr->get_documentElement(&xmlRoot);
  CComBSTR tmp;
  docPtr->get_xml(&tmp);
  CString cstrtmp = OLE2A(tmp);
  varOut = xmlRoot->hasChildNodes();

  CComBSTR bstrRace("race");

  xmlnodeRaces = docPtr->selectNodes((BSTR)bstrRace);
  xmlnodeRaces->get_length(&NumRaces);
  xmlNode = xmlnodeRaces->Getitem(0L);

///.... continues but the rest is irrelevant here



Sun, 11 Jul 2004 13:56:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How to avoid MIDL multiple definitions conflicts when using an interface from msxml4.dll

2. #import MSXML4.DLL problem

3. VC++ 7 / ATL / importlib / msxml4

4. Need examples using MSXML4.0 with c++ MFC

5. ServerXMLHTTP (from MSXML3 or MSXML4)

6. Memory Leaks in MSXML4

7. IMallocSpy and msxml4

8. IMallocSpy and MSXML4

9. VC++ 7 / ATL / importlib / msxml4

10. Leaky code that uses MSXML4

11. Leaky MSXML4 code

12. problems with msxml4.0 and smart pointers

 

 
Powered by phpBB® Forum Software