我想在 Visual C++ 中针对 XSD 模式验证 XML 文件。我浏览了互联网,发现的 MSXML 示例似乎是最简单的。
我正在尝试将其整合到我正在从事的项目中。我创建了XMLSchemaValidation
类来对某些 XSD 模式执行验证,并使用相应的 XSD 文件名初始化对象。我在头文件中有以下指令:
#import "C:\Windows\System32\msxml6.dll"
但我开始发现以下错误:
7>d:\proiecte\wtlcommon\basegui\gdiplushelpers.h(28): error C2872: 'Font' : ambiguous symbol
7> could be 'c:\program files (x86)\microsoft visual studio 10.0\vc\include\comdef.h(312) : Font'
7> or 'c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gdiplusheaders.h(244) : Gdiplus::Font'
我也得到:
7>...\wizarddlgskin.h(96): error C2259: 'Font' : cannot instantiate abstract class
7> due to following members:
7> 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\unknwn.h(116) : see declaration of 'IUnknown::QueryInterface'
7> 'ULONG IUnknown::AddRef(void)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\unknwn.h(120) : see declaration of 'IUnknown::AddRef'
7> 'ULONG IUnknown::Release(void)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\unknwn.h(122) : see declaration of 'IUnknown::Release'
7> 'HRESULT IDispatch::GetTypeInfoCount(UINT *)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(2123) : see declaration of 'IDispatch::GetTypeInfoCount'
7> 'HRESULT IDispatch::GetTypeInfo(UINT,LCID,ITypeInfo **)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(2126) : see declaration of 'IDispatch::GetTypeInfo'
7> 'HRESULT IDispatch::GetIDsOfNames(const IID &,LPOLESTR *,UINT,LCID,DISPID *)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(2131) : see declaration of 'IDispatch::GetIDsOfNames'
7> 'HRESULT IDispatch::Invoke(DISPID,const IID &,LCID,WORD,DISPPARAMS *,VARIANT *,EXCEPINFO *,UINT *)' : is abstract
7> c:\program files (x86)\microsoft sdks\windows\v7.0a\include\oaidl.h(2138) : see declaration of 'IDispatch::Invoke'
我最初#import <msxml.dll>
在示例代码中拥有,但 MSXML 安装并没有将文件放在他们所说的 W7 上。
我已经#define WIN32_LEAN_AND_MEAN
在 stdafx.h 文件中删除(在 Visual c++ 上使用 msxml6.h 时出错)
我究竟做错了什么?