pugixml比tinyxml快不止一个数量级
pugixml 可以在github上直接下载到源码 https://github.com/zeux/pugixml

包括两个头文件(pugixml.hpp  pugiconfig.hpp) 和 一个源文件(pugixml.cpp)

 

例子1

 1 <?xml version="1.0" encoding="UTF-8" standalone="no" ?>  
 2 <Profile FormatVersion="1">  
 3     <Tools>  
 4         <Tool Filename="jam" AllowIntercept="true">  
 5             <Description>Jamplus build system</Description>  
 6         </Tool>  
 7         <Tool Filename="mayabatch.exe" AllowRemote="true" OutputFileMasks="*.dae" DeriveCaptionFrom="lastparam" Timeout="40" />  
 8         <Tool Filename="meshbuilder_*.exe" AllowRemote="false" OutputFileMasks="*.mesh" DeriveCaptionFrom="lastparam" Timeout="10" />  
 9         <Tool Filename="texbuilder_*.exe" AllowRemote="true" OutputFileMasks="*.tex" DeriveCaptionFrom="lastparam" />  
10         <Tool Filename="shaderbuilder_*.exe" AllowRemote="true" DeriveCaptionFrom="lastparam" />  
11     </Tools>  
12 </Profile>
13 
14 pugi::xml_document doc;  
15 if (!doc.load_file("xgconsole.xml")) return -116 pugi::xml_node tools = doc.child("Profile").child("Tools");  
17 for (pugi::xml_node tool = tools.first_child(); tool; tool = tool.next_sibling())  
18 19  std::cout << "Tool:"20  for (pugi::xml_attribute attr = tool.first_attribute(); attr; attr = attr.next_attribute())  
21  {  
22   std::cout << " " << attr.name() << "=" << attr.value();  
23  }  
24  std::cout << std::endl;  
25
View Code

相关文章:

  • 2022-12-23
  • 2021-08-19
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
相关资源
相似解决方案