开发者

XML parsers for C++ which convert xml nodes to C++ objects

Ive a requirement to parse a XML file, and create a tree of nodes inside my application, which then will be used for other purposes开发者_StackOverflow like searching and stuff.

The node structure is homogeneous in nature, i.e it will have only a few fields/attricutes like 1.Id 2.Data 3.Children.Even the xml node will be similar, i.e id, data and children

Can anyone help me with which library should I use so as to create something like this??

Thanks


A very good library for this is Boost.PropertyTree. Look at this example of how to use it with XML:
► http://www.boost.org/doc/libs/1_41_0/doc/html/boost_propertytree/tutorial.html

The property tree itself is agnostic of the XML file. If you do this right, your objects will also be agnostic of XML, which makes your code more flexible.


A very very easy one to use is mini xml (abbreviated to mxml)

http://www.minixml.org/


I'm normally using libxml2 for this - admittedly it's C, but does create a tree of objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜