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)失败,说是"文档的顶层无效。"