CString strFileName (".\\lwd.xml"); // convert xml file name string to something COM can handle (BSTR)
_bstr_t bstrFileName;
bstrFileName = strFileName.AllocSysString(); // call the IXMLDOMDocumentPtr's load function to load the XML document
_variant_t vResult;
VARIANT_BOOL nRtn;
vResult = m_plDomDocument->loadXML(bstrFileName,&nRtn);
if (((bool)vResult) == TRUE) // success!
{
// now that the document is loaded, we need to initialize the root pointer
//m_pDocRoot = m_plDomDocument->documentElement;
if(m_plDomDocument->get_documentElement(&m_pDocRoot)==S_FALSE){
IXMLDOMParseErrorPtr err;
m_plDomDocument->get_parseError(&err);
BSTR buf;
err->get_reason(&buf);
}在vs6.0中没错 ,vs8.0中 m_plDomDocument->get_documentElement(&m_pDocRoot)失败,说是"文档的顶层无效。"
_bstr_t bstrFileName;
bstrFileName = strFileName.AllocSysString(); // call the IXMLDOMDocumentPtr's load function to load the XML document
_variant_t vResult;
VARIANT_BOOL nRtn;
vResult = m_plDomDocument->loadXML(bstrFileName,&nRtn);
if (((bool)vResult) == TRUE) // success!
{
// now that the document is loaded, we need to initialize the root pointer
//m_pDocRoot = m_plDomDocument->documentElement;
if(m_plDomDocument->get_documentElement(&m_pDocRoot)==S_FALSE){
IXMLDOMParseErrorPtr err;
m_plDomDocument->get_parseError(&err);
BSTR buf;
err->get_reason(&buf);
}在vs6.0中没错 ,vs8.0中 m_plDomDocument->get_documentElement(&m_pDocRoot)失败,说是"文档的顶层无效。"
解决方案 »
- Imagelist风格//ILC_MASK一点作用没有吧???
- ssdt hook问题
- 求助,关于设置文件(目录)权限的问题
- 怎样在toolbar中设置宽度不同的按钮,并配上相应大小的贴图?
- 即时通讯UI设计找----兼职或外包
- 为什么在聚焦到CRichEditCtrl窗口时会导致文字全部被选择?
- 要将LISTVIEW的一个列变成组合框控件,该怎么办?
- 求windows程序设计第五版的源代码(搜过了都过期了)
- 模态对话框最小化后,却没有图标,白板一个,为啥?
- 如何使新生成的CString对象指向一个已经存在的字符数组?
- combox问题
- 如何做到像XP操作系统这样的工具栏,不依赖任何第三方工具,只用MFC的类。vc6的只支持16色的,怎么才能支持32位的阿??
有什么不妥吗?
msxml4.0在MSXML 4.0 SDK 中
有个例子 关于 createElement Method
可以参考下。