智能感知:命名空间"MSXML2"在 VS2012 中没有成员"DOMDocument"

IntelliSense: namespace "MSXML2" has no member "DOMDocument" in VS2012

本文关键字:DOMDocument 成员 VS2012 感知 命名空间 MSXML2 智能      更新时间:2023-10-16

我正在尝试编译我继承的项目,然后遇到此错误。以下是一些相关代码:

#include <msxml.h>
...
HRESULT hr;
hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument));

有人能帮忙吗?

我在Windows 8中也看到了类似的问题。MSXML 6.0似乎不公开DOMDocument,但它公开了DOMDocument60。为了帮助其他人通过搜索找到这里,你可能还会看到编译错误:错误C2039: 'DOMDocument':不是'MSXML2'的成员

尝试做以下更改以显式地使用6.0接口:

#import "msxml6.dll"
...
HRESULT hr;
hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60));

我看到其他人有这个问题,但在Excel自动化的背景下。