惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Palo Alto Networks Blog
Martin Fowler
Martin Fowler
T
Threatpost
D
Docker
S
Schneier on Security
M
MIT News - Artificial intelligence
G
Google Developers Blog
L
LINUX DO - 热门话题
J
Java Code Geeks
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
人人都是产品经理
人人都是产品经理
Spread Privacy
Spread Privacy
T
Tailwind CSS Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
CERT Recently Published Vulnerability Notes
The GitHub Blog
The GitHub Blog
Simon Willison's Weblog
Simon Willison's Weblog
NISL@THU
NISL@THU
MongoDB | Blog
MongoDB | Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Heimdal Security Blog
Recorded Future
Recorded Future
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
P
Privacy International News Feed
P
Proofpoint News Feed
O
OpenAI News
B
Blog
腾讯CDC
F
Full Disclosure
Apple Machine Learning Research
Apple Machine Learning Research
T
Tor Project blog
H
Hacker News: Front Page
Project Zero
Project Zero
Hugging Face - Blog
Hugging Face - Blog
C
Cisco Blogs
S
Security Affairs

博客园 - 今夜太冷

GPG(GnuPG)入门 Session variables lost after the call of Response.Redirect method c++中POD类型和non-POD类型 关于c++ template的branching和Recursion的一段很好的描述 How do I remove a particular element from an array in JavaScript? Get the client's IP address in socket.io 前端 使用 crypto-js 对数据进行对称加密 C++ delegate的几种方法 MFC更换窗口图标 boost::make_function_output_iterator报错: C4996 How to copy the contents of std::vector to c-style static array,safely? std::vector push_back报错Access violation Structured Exception Handling Catch a Memory Access Violation in C++ Windows上的字符转换之CP_ACP和CP_OEMCP Initialize a vector in C++ (5 different ways) MFC中使用ATL报错:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C++ WINDOWS下 wchar_t *和char * 相互转化总结篇 VS2008 编译出错 fatal error C1859: unexpected precompiled header error, simply rerunning the compiler might fix this problem
解析XML出错,无法创建DOMDocument对象
今夜太冷 · 2018-08-11 · via 博客园 - 今夜太冷

【问题】

加载XML配置文件时,创建DOMDocument对象总是失败,创建代码如下:

MSXML2::IXMLDOMDocumentPtr pXMLDoc;

MSXML2::IXMLDOMElementPtr xmlRoot;

//创建DOMDocument对象

HRESULT hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));

if(!SUCCEEDED(hr))

{

AfxMessageBox(_T("无法创建DOMDocument对象,请检查是否安装了MS XML Parser 运行库!"));

return ;

}

以前都没这问题,今天不知道怎么一直这样,求大神指点

【回答】

我以前也碰过这个问题,那是因为没有安装xmldom 40或者坏了.
可以试试xmldom 26, xmldom 30, xmldom 60, 不要写死就只能创建40

[注]仿照这个,我写了如下的代码,就成功了

     HRESULT HR = XMLDOC.CreateInstance(_uuidof(MSXML2::DOMDocument40));

     if(!SUCCEEDED(HR))

     {

        HR = XMLDOC.CreateInstance(_uuidof(MSXML2::DOMDocument60));

        if(!SUCCEEDED(HR))

        {

            HR = XMLDOC.CreateInstance(_uuidof(MSXML2::DOMDocument30));

            if(!SUCCEEDED(HR))

            {

                HR = XMLDOC.CreateInstance(_uuidof(MSXML2::DOMDocument26));

                if(!SUCCEEDED(HR))

                {

                    goto EXIT;

                }

            }

        }

     }