主题:vc装载xml文档失败(回帖给分 )急~~!!!
HRESULT hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument,(void**)&spXMLDOM);*/
CComPtr<IXMLDOMDocument> spXMLDOM;
HRESULT hr = spXMLDOM.CoCreateInstance(__uuidof(DOMDocument));
if ( FAILED(hr) ) throw "不能创建XML Parser对象";
if ( spXMLDOM.p == NULL ) throw "不能创建XML Parser对象";
// 如果对象创建成功的话,就开始装载XML文档
VARIANT_BOOL bSuccess=VARIANT_TRUE;
hr = spXMLDOM->load(CComVariant(L"xmldata.xml"),&bSuccess);
if ( FAILED(hr) ) throw "不能够在解析器中装载XML文档";
if(bSuccess){MessageBox(0,"Load Success!","weixin",0); }
if ( !bSuccess) {
MessageBox(0,"不能够在解析器中装载XML文档","weixin",0);
throw "不能够在解析器中装载XML文档";
}bSuccess得到的值是VARIANT_FALSE,哪位大虾说下。
IID_IXMLDOMDocument,(void**)&spXMLDOM);*/
CComPtr<IXMLDOMDocument> spXMLDOM;
HRESULT hr = spXMLDOM.CoCreateInstance(__uuidof(DOMDocument));
if ( FAILED(hr) ) throw "不能创建XML Parser对象";
if ( spXMLDOM.p == NULL ) throw "不能创建XML Parser对象";
// 如果对象创建成功的话,就开始装载XML文档
VARIANT_BOOL bSuccess=VARIANT_TRUE;
hr = spXMLDOM->load(CComVariant(L"xmldata.xml"),&bSuccess);
if ( FAILED(hr) ) throw "不能够在解析器中装载XML文档";
if(bSuccess){MessageBox(0,"Load Success!","weixin",0); }
if ( !bSuccess) {
MessageBox(0,"不能够在解析器中装载XML文档","weixin",0);
throw "不能够在解析器中装载XML文档";
}bSuccess得到的值是VARIANT_FALSE,哪位大虾说下。