码迷,mamicode.com
首页 > 其他好文 > 详细

pugixml 读取

时间:2018-07-03 14:46:53      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:get   %s   com   string   name   fir   odi   nbsp   sibling   

xml

<?xml version="1.0" encoding="utf-8" ?>    
 <ROOT>   
 <COMPANY>Tencent</COMPANY> 
 <STAFFS>
	<STAFF NAME = "clx"/>
	<STAFF NAME = "Jx"/>
        <STAFF NAME = "zhx"/>
 </STAFFS>     
 </ROOT>      

  

 

code

pugi::xml_document doc;
pugi::xml_node root_node = doc.child("ROOT");

// get node by name
std::string company = root_node .child("COMPANY").child_value();


for (pugi::xml_node node = _node.child("STAFFS").first_child(); node; node = node.next_sibling())
{
	std::string name = std::string(node.attribute("NAME").value());
	
	printf("load %s \n", name.c_str());
}

  

 

pugixml 读取

标签:get   %s   com   string   name   fir   odi   nbsp   sibling   

原文地址:https://www.cnblogs.com/alexYuin/p/9257621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!