当前位置: 首页>>代码示例>>C++>>正文


C++ IXMLDOMDocument::put_preserveWhiteSpace方法代码示例

本文整理汇总了C++中IXMLDOMDocument::put_preserveWhiteSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMDocument::put_preserveWhiteSpace方法的具体用法?C++ IXMLDOMDocument::put_preserveWhiteSpace怎么用?C++ IXMLDOMDocument::put_preserveWhiteSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IXMLDOMDocument的用法示例。


在下文中一共展示了IXMLDOMDocument::put_preserveWhiteSpace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

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;
}
开发者ID:0x00dec0de,项目名称:Zeus,代码行数:12,代码来源:xmlparser.cpp

示例2: 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;
}
开发者ID:925coder,项目名称:wix3,代码行数:69,代码来源:xmlutil.cpp

示例3: 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;
}
开发者ID:925coder,项目名称:wix3,代码行数:73,代码来源:xmlutil.cpp


注:本文中的IXMLDOMDocument::put_preserveWhiteSpace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。