我安装了msxml4.0以后,按照sdk的帮助建立了vc项目,可是
#include <stdio.h>
#include <msxml2.h>
// You might need to add the msxml4/sdk/(inc, lib) directories
// to the Tools->Options...->Directories in Visual Studio.
//
// You might also need to append "msxml2.lib" to the
// Project->Settings...->Link->Object/Libray Modules field.int main(int argc, char* argv[])
{
HRESULT hr;
IXMLDOMDocument3 *pXMLDoc = NULL;
IXMLDOMParseError * pObjError = NULL;
BSTR bstr = NULL;
VARIANT_BOOL status;
VARIANT vSrc; CoInitialize(NULL); hr = CoCreateInstance(CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument3,(void**)&pXMLDoc); if (FAILED(hr))
{
printf("Failed to CoCreate an instance of an XML DOM\n");
printf("Error code: %x\n", hr);
goto clean;
} hr = pXMLDoc->put_async(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to set async property\n");
goto clean;
} hr = pXMLDoc->put_validateOnParse(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to set validateOnParse\n");
goto clean;
} hr = pXMLDoc->put_resolveExternals(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to disable resolving externals.\n");
goto clean;
} VariantInit(&vSrc);
V_BSTR(&vSrc) = SysAllocString(L"stocks.xml");
V_VT(&vSrc) = VT_BSTR; hr = pXMLDoc->load(vSrc, &status); if(status!=VARIANT_TRUE)
{
hr = pXMLDoc->get_parseError(&pObjError);
hr = pObjError->get_reason(&bstr);
printf("Failed to load DOM from books.xml. %S\n",bstr);
goto clean;
} hr = pXMLDoc->get_xml(&bstr);
printf("stocks.xml:\n%S\n", bstr);clean:
if (bstr)
SysFreeString(bstr);
if (&vSrc)
VariantClear(&vSrc);
if (pObjError)
pObjError->Release();
if (pXMLDoc)
pXMLDoc->Release();
CoUninitialize();
return 0;}
IXMLDOMDocument3 更本无法识别,我是按照帮助上一步一步做的,请问msxml3.0和4.0是否可以同时安装到一个机器上?还是其他问题?
#include <stdio.h>
#include <msxml2.h>
// You might need to add the msxml4/sdk/(inc, lib) directories
// to the Tools->Options...->Directories in Visual Studio.
//
// You might also need to append "msxml2.lib" to the
// Project->Settings...->Link->Object/Libray Modules field.int main(int argc, char* argv[])
{
HRESULT hr;
IXMLDOMDocument3 *pXMLDoc = NULL;
IXMLDOMParseError * pObjError = NULL;
BSTR bstr = NULL;
VARIANT_BOOL status;
VARIANT vSrc; CoInitialize(NULL); hr = CoCreateInstance(CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument3,(void**)&pXMLDoc); if (FAILED(hr))
{
printf("Failed to CoCreate an instance of an XML DOM\n");
printf("Error code: %x\n", hr);
goto clean;
} hr = pXMLDoc->put_async(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to set async property\n");
goto clean;
} hr = pXMLDoc->put_validateOnParse(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to set validateOnParse\n");
goto clean;
} hr = pXMLDoc->put_resolveExternals(VARIANT_FALSE);
if (FAILED(hr))
{
printf("Failed to disable resolving externals.\n");
goto clean;
} VariantInit(&vSrc);
V_BSTR(&vSrc) = SysAllocString(L"stocks.xml");
V_VT(&vSrc) = VT_BSTR; hr = pXMLDoc->load(vSrc, &status); if(status!=VARIANT_TRUE)
{
hr = pXMLDoc->get_parseError(&pObjError);
hr = pObjError->get_reason(&bstr);
printf("Failed to load DOM from books.xml. %S\n",bstr);
goto clean;
} hr = pXMLDoc->get_xml(&bstr);
printf("stocks.xml:\n%S\n", bstr);clean:
if (bstr)
SysFreeString(bstr);
if (&vSrc)
VariantClear(&vSrc);
if (pObjError)
pObjError->Release();
if (pXMLDoc)
pXMLDoc->Release();
CoUninitialize();
return 0;}
IXMLDOMDocument3 更本无法识别,我是按照帮助上一步一步做的,请问msxml3.0和4.0是否可以同时安装到一个机器上?还是其他问题?
解决方案 »
- 怎么在预览框中预览对话框里生成的图片?
- 怎么给一个按钮画背景色
- 关于模板: 动态分配模板,Debug可以编译,Release下提示莫名其妙的错误!
- 急!!!请问,如何把用邻接表存储的图形信息画图显示?
- 数据库内容在CListCtrl中显示,当查询出来的内容很多越占内存的问题如何解决
- 请问各位怎样调用CListCtrl的DrawItem
- 读取颜色值
- DllMain为什么说重复定义了?
- ?????随机函数?????
- VSS2005怎么签出以前的版本呢,教教我吧
- windows登陆:gina。如何在自己的gina中的WlxLoggedOutSAS,用LogonUser登陆。(老是死机!!!!???)
- 怎么样最快地在一个windows下的文件中插入一段内容
#import <msxml4.dll> named_guids
using namespace MSXML2;
在网络上有啥优势啊?