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


当前回答

TinyXML试试。

http://sourceforge.net/projects/tinyxml

其他回答

TiCPP是TinyXML的“更c++”版本。

'TiCPP' is short for the official name TinyXML++. It is a completely new interface to TinyXML (http://www.grinninglizard.com/tinyxml/) that uses MANY of the C++ strengths. Templates, exceptions, and much better error handling. It is also fully documented in doxygen. It is really cool because this version let's you interface tiny the exact same way as before or you can choose to use the new 'ticpp' classes. All you need to do is define TIXML_USE_TICPP. It has been tested in VC 6.0, VC 7.0, VC 7.1, VC 8.0, MinGW gcc 3.4.5, and in Linux GNU gcc 3+

尝试TinyXML或IrrXML…两者都是轻量级XML解析器(无论如何,我建议您使用TinyXML)。

TinyXML,还有boost。propertytree。后者并不满足所有的官方要求,但非常简单。

我是一个c++新手,在尝试了这个页面上的几个不同的建议后,我必须说我最喜欢pugixml。它有易于理解的文档和高层次的API,这是我一直在寻找的。

如果你关心效率/内存管理,不要使用TinyXML(它倾向于分配大量的小块)。我个人最喜欢的是RapidXML。