RapidXml 简介

RapidXml 简介2019独角兽企业重金招聘Python工程师标准>>>…

大家好,又见面了,我是你们的朋友全栈君。

来自:http://rapidxml.sourceforge.net/manual.html

RapidXml is an attempt to create the fastest XML DOM parser possible, while retaining useability, portability and reasonable W3C compatibility. It is an in-situ parser written in C++, with parsing speed approaching that of
strlen() function executed on the same data.


RapidXml 试图成为最快的 XML DOM 解析
工具包,同时保证解析结果的可用性、可移植性以及与 W3C 标准的兼容性。RapidXml 使用 C++ 编写,因此在操作同一数据时,其解析速度接近于 strlen() 函数。

Entire parser is contained in a single header file, so no building or linking is neccesary. To use it you just need to copy
rapidxml.hpp file to a convenient place (such as your project directory), and include it where needed. You may also want to use printing functions contained in header
rapidxml_print.hpp.


整个解析工具包包含在一个头文件中,所以使用时不用编译也不用连接。要想使用 RapidXml 只要包含 rapidxml.hpp 即可,当然如果要用附加功能(如打印函数),你可以包含 rapidxml_print.hpp 文件。

1.1 Dependencies And Compatibility【依赖性与兼容性

RapidXml has
no dependencies other than a very small subset of standard C++ library (
<cassert>,
<cstdlib>,
<new> and
<exception>, unless exceptions are disabled). It should compile on any reasonably conformant compiler, and was tested on Visual C++ 2003, Visual C++ 2005, Visual C++ 2008, gcc 3, gcc 4, and Comeau 4.3.3. Care was taken that no warnings are produced on these compilers, even with highest warning levels enabled.


除了标准C++库中的 cassert、cstdlib、new、exception外,RapidXml几乎不依赖于其他库,几乎能够在任何编译器上通过,经过测试的有
Visual C++ 2003, Visual C++ 2005, Visual C++ 2008, gcc 3, gcc 4, and Comeau 4.3.3。

1.2 Character Types And Encodings【字符类型和编码

RapidXml is character type agnostic, and can work both with narrow and wide characters. Current version does not fully support UTF-16 or UTF-32, so use of wide characters is somewhat incapacitated. However, it should succesfully parse
wchar_t strings containing UTF-16 or UTF-32 if endianness of the data matches that of the machine. UTF-8 is fully supported, including all numeric character references, which are expanded into appropriate UTF-8 byte sequences (unless you enable parse_no_utf8 flag).


RapidXml的字符类型检查不严格(?),窄字符和宽字符
均可以被处理。由于目前版本不支持 UTF-16和UTF-32,因此宽字符的处理范围还有待改进,UTF-8完全没有问题。

Note that RapidXml performs no decoding – strings returned by name() and value() functions will contain text encoded using the same encoding as source file. Rapidxml understands and expands the following character references:
&apos; &amp; &quot; &lt; &gt; &#...; Other character references are not expanded.


注意:name()函数返回不解码的值,value()函数返回以原编码方式编码的文本值。RapidXml认
&apos; &amp; &quot; &lt; &gt; &#...;

1.3 Error Handling【错误处理

By default, RapidXml uses C++ exceptions to report errors. If this behaviour is undesirable, RAPIDXML_NO_EXCEPTIONS can be defined to suppress exception code. See
parse_error class and
parse_error_handler() function for more information.


一般情况下,RapidXml使用 C++的异常处理报告错误,如果异常行为无法预期,可定义
RAPIDXML_NO_EXCEPTIONS。

1.4 Memory Allocation【内存分配

RapidXml uses
a special memory pool object
to allocate nodes and attributes, because direct allocation using
new operator would be far too slow. Underlying memory allocations performed by the pool can be customized by use of
memory_pool::set_allocator() function. See class
memory_pool for more information.

1.5 W3C Compliance【W3C兼容性

RapidXml is not a W3C compliant parser, primarily
because it ignores DOCTYPE declarations. There is a number of other, minor incompatibilities as well. Still, it can successfully parse and produce complete trees of all valid XML files in W3C conformance suite (over 1000 files specially designed to find flaws in XML processors). In destructive mode it performs whitespace normalization and character entity substitution for a small set of built-in entities.


并非W3C兼容的XML解析器,但问题不大。

1.6 API Design【API设计原则

RapidXml API is minimalistic, to reduce code size as much as possible, and facilitate use in embedded environments. Additional convenience functions are provided in separate headers:
rapidxml_utils.hpp and
rapidxml_print.hpp. Contents of these headers is not an essential part of the library, and is currently not documented (otherwise than with comments in code).


API设计坚持最小化原则,以尽可能减少代码尺寸,使之适用于嵌入式环境。

1.7 Reliability【稳定性

RapidXml is
very robust and comes with a large harness of unit tests. Special care has been taken to ensure stability of the parser no matter what source text is thrown at it. One of the unit tests produces 100,000 randomly corrupted variants of XML document, which (when uncorrupted) contains all constructs recognized by RapidXml. RapidXml passes this test when it correctly recognizes that errors have been introduced, and does not crash or loop indefinitely.

Another unit test puts RapidXml head-to-head with another, well estabilished XML parser, and verifies that their outputs match across a wide variety of small and large documents.

Yet another test feeds RapidXml with over 1000 test files from W3C compliance suite, and verifies that correct results are obtained. There are also additional tests that verify each API function separately, and test that various parsing modes work as expected.

1.8 Acknowledgements

I would like to thank Arseny Kapoulkine for his work on
pugixml, which was an inspiration for this project. Additional thanks go to Kristen Wegner for creating
pugxml, from which pugixml was derived. Janusz Wohlfeil kindly ran RapidXml speed tests on hardware that I did not have access to, allowing me to expand performance comparison table.


类别:
Xml 
查看评论

转载于:https://my.oschina.net/zhmsong/blog/5230

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/160911.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • sqlite sql 修改字段类型「建议收藏」

    sqlite sql 修改字段类型「建议收藏」SQLite仅仅支持ALTERTABLE语句的一部分功能,我们可以用ALTERTABLE语句来更改一个表的名字,也可向表中增加一个字段(列),但是我们不能删除一个已经存在的字段,或者更改一个已经存在的字段的名称、数据类型、限定符等等。改变表名-ALTERTABLE旧表名RENAMETO新表名增加一列-ALTERTABLE表名ADDCOLUMN列名

    2022年6月11日
    202
  • 企业 keepalived 高可用项目实战

    企业 keepalived 高可用项目实战Listitem企业keepalived高可用项目实战1、KeepalivedVRRP介绍keepalived是什么keepalived是集群管理中保证集群高可用的一个服务软件,用来防止单点故障。keepalived工作原理keepalived是以VRRP协议为实现基础的,VRRP全称VirtualRouterRedundancyProtocol,即虚拟路由冗余协议。虚拟路由冗余协议,可以认为是实现高可用的协议,即将N台提供相同功能的路由器组成一个..

    2022年7月13日
    11
  • 电信光猫改桥接模式教程_千兆光猫有必要改桥接模式吗

    电信光猫改桥接模式教程_千兆光猫有必要改桥接模式吗如果只是改桥接可以试试下面这两个地址:http://192.168.1.1/bridge_route.gchhttp://192.168.1.1:8080/bridge_route.gch转载于:https://www.cnblogs.com/Devopser/p/11257535.html…

    2022年10月8日
    0
  • 0xc0000225无法进系统_U盘装win10后无法进系统错误代码0xc0000225怎么修复「建议收藏」

    0xc0000225无法进系统_U盘装win10后无法进系统错误代码0xc0000225怎么修复「建议收藏」win10系统的安装方式有多种,当我们使用的win10系统出现故障时,最常见的解决方法就是使用U盘装win10来修复,可是最近有用户在用U盘装win10后无法进系统出现错误代码0xc0000225现象,那么又该如何解决这一问题呢?下面就来教大家解决U盘装win10后无法进系统错误代码0xc0000225的修复方法。故障提示:File:\Windwows\system32\winload.efiEr…

    2022年6月26日
    28
  • f1 score是什么_F1值

    f1 score是什么_F1值F1score是一个平均数;对精确率与召回率进行平均的一个结果;平均算法有四个,如图所示:调和平均数:Hn=n/(1/a1+1/a2+…+1/an)几何平均数:Gn=(a1a2…an)^(1/n)算术平均数:An=(a1+a2+…+an)/n平方平均数:Qn=√[(a1^2+a2^2+…+an^2)/n]这四种平均数满足Hn≤Gn≤An≤QnF…

    2022年10月14日
    0
  • 手机版mt4如何操作_安卓不能下载MT4

    手机版mt4如何操作_安卓不能下载MT4新手客户按照本文操作流程操作几遍,对MT4手机软件基本上就会非常熟练了。导航目录1.下载显示隐藏重新排序简单/高级视图新建图表行情周期添加/删除指标APP手机端MT4软件的功能模块一、软件下载登录1.下载通过无佣网开户的客户,下载对应APP手机版MT4软件后,手机桌面会有该交易商的软件图标,类似如下:2.登录点击MT4图标打开软件,点击软件左上角,进入“管理账户”里添加交易账户。已添加的交易账户,…

    2022年8月15日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号