轻量级C ++ SAX XML解析器 [英] Light weight C++ SAX XML parser

查看:139
本文介绍了轻量级C ++ SAX XML解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道至少有三个轻量级C ++ XML解析器: RapidXML TinyXML PugiXML 。然而,所有这三个使用基于DOM的接口(即,他们构建自己的XML文档的内存中表示,然后提供一个接口来遍历和操作它)。对于我必须处理的大多数情况,我更喜欢SAX接口(其中解析器只是发出一个事件流,如start-of-tag,应用程序代码负责根据这些事件做任何想要的事情) 。

I know of at least three light weight C++ XML parsers: RapidXML, TinyXML and PugiXML. However, all three use a DOM based interface (ie, they build their own in-memory representation of the XML document and then provide an interface to traverse and manipulate it). For most situations that I have to deal with, I much prefer the SAX interface (where the parser just spits out a stream of events like start-of-tag, and the application code is responsible for doing whatever it wants based on those events).

任何人都可以推荐一个带有SAX界面的轻量级C ++ XML库?

Can anyone recommend a light weight C++ XML library with a SAX interface?

编辑:请注意Microsoft XmlLite库,它使用SAX接口(实际上是一个拉接口,可能更好)。不幸的是,它排除了我目前为止,因为我知道它的闭源和Windows只有(如果我错了这个请更正我)。

I should also note the Microsoft XmlLite library, which does use a SAX interface (well, actually a "pull" interface which is possibly even better). Unfortunately, it's ruled out for me at the moment since as far as I know it's closed source and Windows only (please correct me if I'm wrong on this).

推荐答案

当我需要解析XML时,我使用了 expat 。它非常轻量级(好,以前,它是一段时间,因为我做了XML的东西),并做的工作。

I've used expat when I needed to parse XML. It's very light-weight (well, it used to be; it's a while since I've done XML stuff) and does the job.

这篇关于轻量级C ++ SAX XML解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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