Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

xml

I am trying to compile a project I inherited, and then encountered this error. Here are some relevant code:

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

Can anybody help?

like image 734
Elderry Avatar asked Jan 19 '13 09:01

Elderry


1 Answers

I am seeing similar issues in Windows 8. It seems that MSXML 6.0 does not expose DOMDocument, but it does expose DOMDocument60. To help others get here via a search, the compiler error you may also see is: error C2039: 'DOMDocument' : is not a member of 'MSXML2'

Try making the following change to use the 6.0 interface explicitly:

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

I see that others have this issue but in the context of Excel automation. See that discussion here.

like image 99
Steven Bone Avatar answered Sep 27 '22 20:09

Steven Bone