解析xml_1



using namespace rapidxml;
xml_document<> doc;    // character type defaults to char
doc.parse<0>(text);    // 0 means default parse flags


cout << "Name of my first node is: " << doc.first_node()->name() << "\n"; xml_node<> *node = doc.first_node("foobar"); cout << "Node foobar has value " << node->value() << "\n"; for (xml_attribute<> *attr = node->first_attribute(); attr; attr = attr->next_attribute()) { cout << "Node foobar has attribute " << attr->name() << " "; cout << "with value " << attr->value() << "\n"; }

 

posted @ 2017-09-21 19:51  _xiaohaige  阅读(133)  评论(0编辑  收藏  举报