各位大虾:
    小的,想请教一个问题.就是在MFC中如何读写XML文档.    .Net中倒是很容易.真接用using System.XML....就行了.可是我这个是在MFC中作的,请各一指教.    谢谢

解决方案 »

  1.   

    example:::CoInitialize(NULL);
    this->m_pDomDocument2 = NULL;
    HRESULT hr = m_pDomDocument2.CreateInstance(__uuidof(MSXML2::DOMDocument30));//装载xml串
    hr = this->m_pDomDocument2->loadXML(strXml.AllocSysString());
      

  2.   

    windows中存在xml的对象模型库,你只要导入他就可以用了
    #import "msxml3.dll" 
    using namespace MSXML2;
      

  3.   

    example:::CoInitialize(NULL);
    this->m_pDomDocument2 = NULL;
    HRESULT hr = m_pDomDocument2.CreateInstance(__uuidof(MSXML2::DOMDocument30));//装载xml串
    hr = this->m_pDomDocument2->loadXML(strXml.AllocSysString());
    ****************************************************************谢谢,但我觉得还有一个问题,
    就是MSXML2没有这个名字空间呢.
    大虾是用那种方式导入MSXML.dll的呢??一种.  #import "msxml3.dll"
           using namespace MSXML2;
    第二种  #include "msxml.h"我用过这两种方式.
    但第一种是找不到名字空间 MSXML2,可能是我导入的MSXML版本不对吧?请指正.
    第二种方式,在VC6.0里面还可以,但在VS2005里面老是报找不到相应的msxml.h.
    烦啊.
    请大虾指导.