C++学习之rapidXML

来源:互联网 发布:巨人网络 世纪游轮 编辑:程序博客网 时间:2024/05/16 05:16

这篇简介写的不错看起来很舒服。

http://semidtor.wordpress.com/2013/03/29/rapidxml-mini-tutorial/

另外下面是官方的文档和下载链接

http://rapidxml.sourceforge.net/


下面是一个自己写的遍历的例子:

#include "../xml/rapidxml.hpp"using namespace std; using namespace rapidxml; 
void traverse(xml_node<>* node){    if(node  && node->type() == node_element){        cout  << endl << node->name() << endl;         cout  << node->value() << endl;         for(xml_node<> *pNode=node->first_node();  pNode;  pNode=pNode->next_sibling()){            traverse(pNode);         }    }}int main(){    xml_document<> doc;     // character type defaults to char    doc.parse<0>(buffer);     // 0 means default parse flags    xml_node<> *pRoot= doc.first_node();     traverse(pRoot); }



0 0
原创粉丝点击