zoukankan      html  css  js  c++  java
  • XMLConfiguration -- Poco

    Library : Util

    Package: Configuration

    Header : Poco/Util.XMLConfiguration.h

    此配置类从 XML 文档中提取配置属性。 支持类似于 xpath 的属性名语法,以允许对 XML 文档的完全访问。 不支持 XML 名称空间。 Xml 文档的根元素的名称不重要并且被忽略。 不支持标记名中的句点。

    以下面的 XML 文档为例:

    <config>
        <prop1>value1</prop1>
        <prop2>value2</prop2>
        <prop3>
           <prop4 attr="value3"/>
           <prop4 attr="value4"/>
        </prop3>
        <prop5 id="first">value5</prop5>
        <prop5 id="second">value6</prop5>
    </config>
    下列属性名称将是有效的,并将产生所示值:

    prop1 -> value1 prop2 -> value2 prop3.prop4 -> (empty string) prop3.prop4[@attr] -> value3 prop3.prop4[1][@attr] -> value4 prop5[0] -> value5 prop5[1] -> value6 prop5[@id=first] -> value5 prop5[@id='second'] -> value6
    不支持枚举属性。 调用键(“ prop3.prop4”)将返回一个空范围。
    作为一种特殊功能,通过将所需的字符传递给构造函数,可以将用于分隔属性名称的分隔符字符更改为句点('.')以外的其他字符。 这允许使用带有句点的元素名称的 XML 文档。
    Direct Base Clases : AbstractConfiguration
    All Base Classes: Poco::RefCountedObject, AbstractConfiguration
    Xmlconfiguration () ; 创建一个带有“ config”根元素的空 XMLConfiguration。
    XMLConfiguration(
        char delim
    );
    使用给定的分隔符 char (而不是默认的“ . ”)创建带有“ config”根元素的空 XMLConfiguration .


    XMLConfiguration(
        Poco::XML::InputSource * pInputSource
    );

    创建 XMLConfiguration 并从给定 InputSource 加载 XML 文档。
    XMLConfiguration(
        std::istream & istr
    );
    创建 XMLConfiguration 并从给定流加载 XML 文档。
    XMLConfiguration(
        const std::string & path
    );
    创建 XMLConfiguration 并从给定路径加载 XML 文档。
    XMLConfiguration(
        const Poco::XML::Document * pDocument
    );
    使用给定的 XML 文档创建 XMLConfiguration。
    XMLConfiguration(
        const Poco::XML::Node * pNode
    );
    使用给定的 XML 节点创建 XMLConfiguration
    XMLConfiguration(
        Poco::XML::InputSource * pInputSource,
        char delim
    );
    创建 XMLConfiguration 并从给定 InputSource 加载 XML 文档。 使用给定的分隔符字符,而不是默认的“ . ” .
    XMLConfiguration(
        std::istream & istr,
        char delim
    );
    创建 XMLConfiguration 并从给定流加载 XML 文档。 使用给定的分隔符字符,而不是默认的“ . ” .
    XMLConfiguration(
        const std::string & path,
        char delim
    );
    创建 XMLConfiguration 并从给定路径加载 XML 文档。 使用给定的分隔符字符,而不是默认的“ . ” .
    XMLConfiguration(
        const Poco::XML::Document * pDocument,
        char delim
    );
    使用给定的 XML 文档创建 XMLConfiguration。 使用给定的分隔符字符,而不是默认的“ . ” .
    XMLConfiguration(
        const Poco::XML::Node * pNode,
        char delim
    );
    使用给定的 XML 节点创建 XMLConfiguration。 使用给定的分隔符字符,而不是默认的“ . ” .
    void load(
        Poco::XML::InputSource * pInputSource
    );
    从给定的 InputSource 加载包含配置数据的 XML 文档。
    void load(
        std::istream & istr
    );
    加载包含来自给定流的配置数据的 XML 文档。
    void load(
        const std::string & path
    );
    从给定文件加载包含配置数据的 XML 文档。
    void load(
        const Poco::XML::Document * pDocument
    );
    从给定的 XML 文档加载包含配置数据的 XML 文档。
    void load(
        const Poco::XML::Node * pNode
    );
    从给定的 XML 节点加载包含配置数据的 XML 文档。
    void loadEmpty(
        const std::string & rootElementName
    );
    加载一个只包含给定名称的根元素的空 XML 文档。
    void save(
        const std::string & path
    ) const;
    将包含配置数据的 XML 文档写入 path 给出的文件。
    void save(
        std::ostream & str
    ) const;
    将包含配置数据的 XML 文档写入给定的流。
    void save(
        Poco::XML::DOMWriter & writer,
        const std::string & path
    ) const;
    使用给定的 DOMWriter 将包含配置数据的 XML 文档写入 path 给出的文件。
    void save(
        Poco::XML::DOMWriter & writer,
        std::ostream & str
    ) const;
    将包含配置数据的 XML 文档写入给定的流。

  • 相关阅读:
    vue + ElementUI 的横向表格代码
    localStorage.getItem
    字符串分割与数组的分割 split()VSsplice()&slice()
    ES6 Class 的基本语法
    e6 6 Symbol
    ES6 Iterator 和 for...of 循环
    ES6 数组的扩展
    element-ui上传一张图片后隐藏上传按钮
    图片上传预览原理及实现
    Winform的一些控件说明
  • 原文地址:https://www.cnblogs.com/Davirain/p/11835327.html
Copyright © 2011-2022 走看看