本文整理汇总了C++中IXMLDOMDocument::put_resolveExternals方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMDocument::put_resolveExternals方法的具体用法?C++ IXMLDOMDocument::put_resolveExternals怎么用?C++ IXMLDOMDocument::put_resolveExternals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXMLDOMDocument
的用法示例。
在下文中一共展示了IXMLDOMDocument::put_resolveExternals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DomFromCOM
// Helper function to create a DOM instance:
IXMLDOMDocument * DomFromCOM()
{
HRESULT hr;
IXMLDOMDocument *pxmldoc = NULL;
HRCALL( CoCreateInstance(__uuidof(DOMDocument40),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IXMLDOMDocument),
(void**)&pxmldoc),
"Create a new DOMDocument");
HRCALL( pxmldoc->put_async(VARIANT_FALSE),
"should never fail");
HRCALL( pxmldoc->put_validateOnParse(VARIANT_FALSE),
"should never fail");
HRCALL( pxmldoc->put_resolveExternals(VARIANT_FALSE),
"should never fail");
return pxmldoc;
clean:
if (pxmldoc)
{
pxmldoc->Release();
}
return NULL;
}
示例2:
static IXMLDOMDocument *createAndConfigureInterface(void)
{
IXMLDOMDocument *xmlDoc = (IXMLDOMDocument *)ComLibrary::_createInterface(CLSID_DOMDocument30, IID_IXMLDOMDocument);
if(xmlDoc != NULL)
{
xmlDoc->put_async(VARIANT_FALSE);
xmlDoc->put_preserveWhiteSpace(VARIANT_FALSE);
xmlDoc->put_resolveExternals(VARIANT_FALSE);
xmlDoc->put_validateOnParse(VARIANT_TRUE);
}
return xmlDoc;
}
示例3: XmlLoadDocumentFromFileEx
/*******************************************************************
XmlLoadDocumentFromFileEx
********************************************************************/
extern "C" HRESULT DAPI XmlLoadDocumentFromFileEx(
__in_z LPCWSTR wzPath,
__in DWORD dwAttributes,
__out IXMLDOMDocument** ppixdDocument
)
{
HRESULT hr = S_OK;
VARIANT varPath;
VARIANT_BOOL vbSuccess = 0;
IXMLDOMDocument* pixd = NULL;
IXMLDOMParseError* pixpe = NULL;
::VariantInit(&varPath);
varPath.vt = VT_BSTR;
varPath.bstrVal = ::SysAllocString(wzPath);
ExitOnNull(varPath.bstrVal, hr, E_OUTOFMEMORY, "failed to allocate bstr for Path in XmlLoadDocumentFromFileEx");
hr = XmlCreateDocument(NULL, &pixd);
if (hr == S_FALSE)
{
hr = E_FAIL;
}
ExitOnFailure(hr, "failed XmlCreateDocument");
if (dwAttributes & XML_LOAD_PRESERVE_WHITESPACE)
{
hr = pixd->put_preserveWhiteSpace(VARIANT_TRUE);
ExitOnFailure(hr, "failed put_preserveWhiteSpace");
}
// Avoid triggering anything external.
hr = pixd->put_validateOnParse(VARIANT_FALSE);
ExitOnFailure(hr, "failed put_validateOnParse");
hr = pixd->put_resolveExternals(VARIANT_FALSE);
ExitOnFailure(hr, "failed put_resolveExternals");
pixd->put_async(VARIANT_FALSE);
hr = pixd->load(varPath, &vbSuccess);
if (S_FALSE == hr)
{
hr = HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
}
if (FAILED(hr) && S_OK == pixd->get_parseError(&pixpe))
{
XmlReportParseError(pixpe);
}
ExitOnFailure1(hr, "failed to load XML from: %ls", wzPath);
if (ppixdDocument)
{
*ppixdDocument = pixd;
pixd = NULL;
}
hr = S_OK;
LExit:
ReleaseVariant(varPath);
ReleaseObject(pixd);
ReleaseObject(pixpe);
return hr;
}
示例4: XmlLoadDocumentEx
/********************************************************************
XmlLoadDocumentEx -
*********************************************************************/
extern "C" HRESULT DAPI XmlLoadDocumentEx(
__in_z LPCWSTR wzDocument,
__in DWORD dwAttributes,
__out IXMLDOMDocument** ppixdDocument
)
{
HRESULT hr = S_OK;
VARIANT_BOOL vbSuccess = 0;
// RELEASEME
IXMLDOMDocument* pixd = NULL;
IXMLDOMParseError* pixpe = NULL;
BSTR bstrLoad = NULL;
if (!wzDocument || !*wzDocument)
{
hr = E_UNEXPECTED;
ExitOnFailure(hr, "string must be non-null");
}
hr = XmlCreateDocument(NULL, &pixd);
if (hr == S_FALSE)
{
hr = E_FAIL;
}
ExitOnFailure(hr, "failed XmlCreateDocument");
if (dwAttributes & XML_LOAD_PRESERVE_WHITESPACE)
{
hr = pixd->put_preserveWhiteSpace(VARIANT_TRUE);
ExitOnFailure(hr, "failed put_preserveWhiteSpace");
}
// Security issue. Avoid triggering anything external.
hr = pixd->put_validateOnParse(VARIANT_FALSE);
ExitOnFailure(hr, "failed put_validateOnParse");
hr = pixd->put_resolveExternals(VARIANT_FALSE);
ExitOnFailure(hr, "failed put_resolveExternals");
bstrLoad = ::SysAllocString(wzDocument);
ExitOnNull(bstrLoad, hr, E_OUTOFMEMORY, "failed to allocate bstr for Load in XmlLoadDocumentEx");
hr = pixd->loadXML(bstrLoad, &vbSuccess);
if (S_FALSE == hr)
{
hr = HRESULT_FROM_WIN32(ERROR_OPEN_FAILED);
}
if (FAILED(hr) && S_OK == pixd->get_parseError(&pixpe))
{
XmlReportParseError(pixpe);
}
ExitOnFailure(hr, "failed loadXML");
hr = S_OK;
LExit:
if (ppixdDocument)
{
*ppixdDocument = pixd;
pixd = NULL;
}
ReleaseBSTR(bstrLoad);
ReleaseObject(pixd);
ReleaseObject(pixpe);
return hr;
}