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

原文转载于:https://www.zhihu.com/question/32046606

作者:叛逆者
链接:https://www.zhihu.com/question/32046606/answer/55728362
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

github.com/fffaraz/awes

这里有个相当全的列表


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

boost中的组件,rapidxml

评论区,龚大说得对
是时候上这张图了:
<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++?
Boost.PropertyTree
微信二维码
CMarkup firstobject.com
我用过API最好用的,堪比Python的ElementTree
Pugixml 我一直用,支持XPath,性能也很好。
而XPath正是RapidXml的弱点。
我只用Pugixml
tiny和lib系都用过,接口都不喜欢
相比而言Pugi接口美得多,性能也强大,何况还有XPath

推荐boost 的property tree
ini
json
xml
三种常用数据格式通吃。

boost.org/doc/libs/1_58
现在是tinyxml2最好,解析性能要好,同时api还要设计的好用,rapidxml性能好,但是不如tinyxml2好用,tinyxml2只需要包含两个头文件,api也设计的很好
tinyxml ?

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

很多的。比如msxml

本人用过libxml, xercesc, tinyxml2, rapidxml

rapidxml性能最好,最适合用作配置存取
最近增加了rapidxml sax解析接口
详见: github.com/halx99/xmldr

xmldrv3早期封装了libxml,xercesc,tinyxml2
统一接口,目前封装了rapidxml
如果我说Qt会不会被鄙视。
tinyxml2非常好用
libxml2, 很好用.
Tinyxml ,github 上的开源项目
Poco库中组件 XML
支持静态库和动态库
类似java 的接口调用,简单易懂
tinyXML
boost也有XML的解析库

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值