您的位置:首页 > 编程语言 > C语言/C++

C++解析xml有什么好用的轮子?

2018-01-23 13:39 369 查看
原文转载于:https://www.zhihu.com/question/32046606

作者:叛逆者

链接:https://www.zhihu.com/question/32046606/answer/55728362

来源:知乎

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

https://github.com/fffaraz/awesome-cpp#xml
这里有个相当全的列表

XML
XML is crap. Really. There are no excuses. XML is nasty to parse for humans, and it's a disaster to parse even for computers. There's just no reason for that horrible crap to exist. - Linus Torvalds

Boost.PropertyTree - A property tree parser/generator that can
be used to parse XML/JSON/INI/Info files. [Boost]
Expat - An XML parser library written in C. [MIT]
Libxml2 - The XML C parser and toolkit of Gnome. [MIT]
libxml++ - An XML Parser for C++. [LGPL2]
PugiXML - A light-weight, simple and fast XML parser for C++ with XPath support. [MIT]
RapidXml - An attempt to create the fastest XML parser possible, while retaining useability,
portability and reasonable W3C compatibility. [Boost]
TinyXML - A simple, small, minimal, C++ XML parser that can be easily integrating into
other programs. [zlib]
TinyXML2 - A simple, small, efficient, C++ XML parser that can be easily integrating
into other programs. [zlib]
TinyXML++ - A completely new interface to TinyXML that uses MANY of the C++ strengths. Templates,
exceptions, and much better error handling. [MIT]
Xerces-C++ - A validating XML parser written in a portable subset of C++. [Apache2]
强烈推荐的是rapidxml

发布于 2015-07-20

60

​6 条评论

​分享

​收藏
​感谢





裴草莓

野性程序猿转家养

6 人赞同了该回答

boost中的组件,rapidxml

评论区,龚大说得对

编辑于 2015-07-20

6

​1 条评论

​分享

​收藏
​感谢





姚冬



程序员编程C++
话题的优秀回答者

14 人赞同了该回答

pugixml - Light-weight, simple and fast XML parser for C++ with XPath support

YY 客户端用的就是这个

发布于 2015-07-20

14

​4 条评论

​分享

​收藏
​感谢



知乎用户

一个纯粹的傻逼

36 人赞同了该回答

是时候上这张图了:

<img data-rawheight="1200" data-rawwidth="1139" src="https://pic4.zhimg.com/50/bae08303994bb81e53254f5f409b5500_hd.jpg" class="origin_image zh-lightbox-thumb" width="1139" data-original="https://pic4.zhimg.com/bae08303994bb81e53254f5f409b5500_r.jpg">


来源
xml parsing - What XML parser should I use in C++?

发布于 2015-07-20

36

​3 条评论

​分享

​收藏
​感谢
收起





空明流转



计算机图形学C++编程
话题的优秀回答者

2 人赞同了该回答

Boost.PropertyTree

发布于 2015-07-20

2

​添加评论

​分享

​收藏
​感谢





dontbeatmycat

http://heleifz.github.io/

1 人赞同了该回答

Are
you using a real XML parser

发布于 2015-11-16

1

​添加评论



​分享

​收藏
​感谢



知乎用户

游戏开发者

3 人赞同了该回答

CMarkup
http://www.firstobject.com
我用过API最好用的,堪比Python的ElementTree

发布于 2015-08-10

3

​添加评论

​分享

​收藏
​感谢





寂静岭

Pugixml 我一直用,支持XPath,性能也很好。

而XPath正是RapidXml的弱点。

发布于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢





做游戏的老G

移动游戏开发,微信公众号:laogdexiaowu

我只用Pugixml

tiny和lib系都用过,接口都不喜欢

相比而言Pugi接口美得多,性能也强大,何况还有XPath

编辑于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢



知乎用户

动如神经,静如痴呆。

3 人赞同了该回答

推荐boost 的property tree

ini

json

xml

三种常用数据格式通吃。

http://www.boost.org/doc/libs/1_58_0/doc/html/property_tree.html

发布于 2015-07-21

3

​2 条评论

​分享

​收藏
​感谢





汪周洋

程序员

3 人赞同了该回答

现在是tinyxml2最好,解析性能要好,同时api还要设计的好用,rapidxml性能好,但是不如tinyxml2好用,tinyxml2只需要包含两个头文件,api也设计的很好

编辑于 2015-07-20

3

​2 条评论

​分享

​收藏
​感谢





蔡杰

求恢复对Dev的信任度

1 人赞同了该回答

tinyxml ?

发布于 2015-07-09

1

​1 条评论

​分享

​收藏
​感谢





凌霄Leon

码农

谁知道C++有哪些sax读xml的库,就是加载大文件(几十G的xml)时能够事务驱动的读取

编辑于 2017-09-21

0

​添加评论

​分享

​收藏
​感谢





勘察加人

计算机工程师

很多的。比如msxml

发布于 2016-10-14

0

​添加评论

​分享

​收藏
​感谢





halx99

游戏开发者

本人用过libxml, xercesc, tinyxml2, rapidxml

rapidxml性能最好,最适合用作配置存取

最近增加了rapidxml sax解析接口

详见: https://github.com/halx99/xmldrv3
xmldrv3早期封装了libxml,xercesc,tinyxml2

统一接口,目前封装了rapidxml

编辑于 2016-08-22

0

​添加评论

​分享

​收藏
​感谢



匿名用户

如果我说Qt会不会被鄙视。

发布于 2015-07-21

0

​添加评论

​分享

​收藏
​感谢





钱海勇

网易 渲染引擎

tinyxml2非常好用

发布于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢





colin zhen

代码搬运工 空想主义者

libxml2, 很好用.

发布于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢



知乎用户

Ph.D. Candidate in CS @ System

Tinyxml ,github 上的开源项目

发布于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢



知乎用户

设计模式

Poco库中组件 XML

支持静态库和动态库

类似java 的接口调用,简单易懂

编辑于 2015-07-20

0

​添加评论

​分享

​收藏
​感谢



知乎用户

桃毛妈妈说,表抖机灵,好好答题,不要卖萌...

tinyXML

boost也有XML的解析库

发布于 2015-07-09

0

​添加评论

​分享

​收藏
​感谢
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: