什么是 C++ 的最佳开放 XML 解析器? [英] What is the best open XML parser for C++?

查看:33
本文介绍了什么是 C++ 的最佳开放 XML 解析器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个简单、干净、正确的 XML 解析器以在我的 C++ 项目中使用.我应该自己写吗?

I am looking for a simple, clean, correct XML parser to use in my C++ project. Should I write my own?

推荐答案

RapidXML?RapidXML 是一个用 C++ 编写的非常快速和小型的 XML DOM 解析器.它主要针对嵌入式环境、计算机游戏或任何其他需要可用内存或 CPU 处理能力的应用程序.RapidXML 在 Boost 软件许可下获得许可,其源代码可免费获得.

How about RapidXML? RapidXML is a very fast and small XML DOM parser written in C++. It is aimed primarily at embedded environments, computer games, or any other applications where available memory or CPU processing power comes at a premium. RapidXML is licensed under Boost Software License and its source code is freely available.

功能

  • 解析速度(包括DOM树建筑)接近速度在上执行的 strlen 函数相同的数据.
  • 在现代 CPU(截至 2008 年)上,解析器吞吐量约10亿每秒字符数.看在线表演部分手册.
  • 代码内存占用小并创建了 DOM 树.
  • 仅标头的实现,简化集成过程.
  • 简单的许可证,允许用于几乎任何目的,无论是商业用途和非商业的,没有任何义务.
  • 支持 UTF-8 和部分 UTF-16,UTF-32 编码.
  • 可移植的源代码,没有除了非常小的依赖项C++ 标准库的子集.
  • 这个子集非常小,可以如果使用,可以很容易地手动模拟不希望使用标准库.

限制

  • 解析器忽略 DOCTYPE声明.
  • 不支持 XML 命名空间.
  • 解析器不检查字符有效性.
  • 解析器的接口没有符合 DOM 规范.
  • 解析器不检查属性唯一性.

来源:wikipedia.org://Rapidxml

根据您的用途,您可以使用 XML 数据绑定吗?CodeSynthesis XSD 是 Code 开发的用于 C++ 的 XML 数据绑定编译器在 GNU GPL 和专有许可证下合成和双重许可.给定一个 XML 实例规范(XML Schema),它生成表示给定词汇表以及解析和序列化代码的 C++ 类.

Depending on you use, you may use an XML Data Binding? CodeSynthesis XSD is an XML Data Binding compiler for C++ developed by Code Synthesis and dual-licensed under the GNU GPL and a proprietary license. Given an XML instance specification (XML Schema), it generates C++ classes that represent the given vocabulary as well as parsing and serialization code.

CodeSynthesis XSD 的独特功能之一是它支持两种不同的 XML 模式到 C++ 的映射:内存中的 C++/树和面向流的 C++/解析器.C++/Tree 映射是具有树状内存数据结构的传统映射.C++/Parser 是一种新的、类似于 SAX 的映射,它将存储在 XML 实例文档中的信息表示为特定于词汇表的解析事件的层次结构.与 C++/Tree 相比,C++/Parser 映射允许处理无法放入内存的大型 XML 文档、执行面向流的处理或使用现有的内存表示.

One of the unique features of CodeSynthesis XSD is its support for two different XML Schema to C++ mappings: in-memory C++/Tree and stream-oriented C++/Parser. The C++/Tree mapping is a traditional mapping with a tree-like, in-memory data structure. C++/Parser is a new, SAX-like mapping which represents the information stored in XML instance documents as a hierarchy of vocabulary-specific parsing events. In comparison to C++/Tree, the C++/Parser mapping allows one to handle large XML documents that would not fit in memory, perform stream-oriented processing, or use an existing in-memory representation.

来源:wikipedia.org://CodeSynthesis XSD

这篇关于什么是 C++ 的最佳开放 XML 解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆