本文整理汇总了C++中msxml2::IXMLDOMDocument2Ptr::GetInterfacePtr方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMDocument2Ptr::GetInterfacePtr方法的具体用法?C++ IXMLDOMDocument2Ptr::GetInterfacePtr怎么用?C++ IXMLDOMDocument2Ptr::GetInterfacePtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMDocument2Ptr
的用法示例。
在下文中一共展示了IXMLDOMDocument2Ptr::GetInterfacePtr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
MSXML2::IXMLDOMDocument2Ptr ValidateConfigXML()
{
wchar_t moduleFileName[MAX_PATH] = {0};
if(0 == GetModuleFileNameW(GetModuleHandle(_T("TestConnectSdk.dll")/*"TestConnectAPITool.dll"*/), moduleFileName, MAX_PATH))
throw Workshare::Exception(_T("Failed to obtain the filename of the current module"));
CStdStringW schemaUrl;
schemaUrl.Format(L"res://%s/ConnectAPITestTool.xsd", moduleFileName);
MSXML2::IXMLDOMDocument2Ptr spConfigSchema;
HRESULT hr = spConfigSchema.CreateInstance(__uuidof(MSXML2::DOMDocument60));
if(FAILED(hr))
throw Workshare::ClassNotFoundException(_T("Msxml2.DOMDocument.6.0"), _T("Failed to create an XML dom object."));
if(VARIANT_TRUE != spConfigSchema->load(schemaUrl.c_str()))
ThrowMSXMLParseError(spConfigSchema->parseError, _T("Failed to load 'ConnectAPITestTool.xsd'."));
MSXML2::IXMLDOMSchemaCollection2Ptr spSchemaCollection;
hr = spSchemaCollection.CreateInstance(__uuidof(MSXML2::XMLSchemaCache60));
if(FAILED(hr))
throw Workshare::ClassNotFoundException(_T("Msxml2.XMLSchemaCache.6.0"), _T("Failed to create an XML schema collection."));
hr = spSchemaCollection->add(L"", spConfigSchema.GetInterfacePtr());
if(S_OK != hr)
throw Workshare::Exception(_T("Failed to add 'ConnectAPITestTool.xsd' to schema collection."));
MSXML2::IXMLDOMDocument2Ptr spConfigXML;
hr = spConfigXML.CreateInstance(__uuidof(MSXML2::DOMDocument60));
if(FAILED(hr))
throw Workshare::ClassNotFoundException(_T("Msxml2.DOMDocument.6.0"), _T("Failed to create an XML dom object."));
spConfigXML->async = VARIANT_FALSE;
spConfigXML->resolveExternals = VARIANT_FALSE;
spConfigXML->validateOnParse = VARIANT_FALSE;
spConfigXML->schemas = spSchemaCollection.GetInterfacePtr();
if(VARIANT_TRUE != spConfigXML->load(L"ConnectAPITestTool.xml"))
ThrowMSXMLParseError(spConfigXML->parseError, _T("Failed to load 'ConnectAPITestTool.xml'."));
MSXML2::IXMLDOMParseErrorPtr spError = spConfigXML->validate();
if(S_OK != spError->errorCode)
ThrowMSXMLParseError(spError, _T("Failed to validate 'ConnectAPITestTool.xml'."));
return spConfigXML;
}