boost库用property_tree读xml文件
来源:互联网 发布:创建windows窗口程序 编辑:程序博客网 时间:2024/05/29 19:28
深刻理解boost property_tree的用法,通过一级循环判断,来遍历xml文件里的一级二级目录;源代码:#include<boost/property_tree/ptree.hpp>#include<boost/property_tree/xml_parser.hpp>#include<iostream>int main(){boost::property_tree::ptree pt;std::string fileName = "E:\\trade\\config\\acsyconf002.xml";boost::property_tree::xml_parser::read_xml(fileName, pt);std::string xml;std::string xml1;for (auto &m : pt){if (m.first == "group"){xml1 = "";xml = m.second.get("account"," ");std::cout << xml << std::endl;for (auto &m1 : m.second){if (m1.first == "user"){xml1 = xml1+m1.second.get_value<std::string>()+"|";}}std::string xml2 = xml1.substr(0, xml1.size()-1);std::cout << xml2 << std::endl;//std::string xmlLast = xml.substr(0, xml.size());//std::cout << xmlLast << std::endl;}}return 0;}XML文件:<config><subport>10003</subport><swebdir>D:\Project\server\src\web</swebdir><database>E:\trade\config\all_cnfut_db_gy.dat</database><filenameURL>H:\tesrt</filenameURL><logURL>E:\trade\log\trade_log_acsy001.log</logURL><swebport>8006</swebport><distbin>D:\Project\tradesrc\bin\Debug</distbin></config><group><account>020368</account><user>01</user><user>02</user><user>03</user></group><group><account>831598</account><user>01</user></group>
0 0
- boost库用property_tree读xml文件
- boost库之property_tree解析xml文件
- boost::property_tree读取解析.xml文件
- boost 之property_tree操作xml文件
- boost使用property_tree操作xml
- boost property_tree 解析json文件
- Boost学习笔记(四)---利用boost::property_tree;读写xml文件,保存文件
- BOOST之property_tree 及解析XML详解
- BOOST之property_tree 及解析XML详解
- 使用boost property_tree 生成XML配置文件
- boost.property_tree解析xml的帮助类
- boost::property_tree
- boost::property_tree
- boost::property_tree
- boost::property_tree
- boost.property_tree
- BOOST property_tree
- boost::property_tree读取解析ini文件
- ITOO4.0项目总结--成长
- leetcode4
- 研究pixhawk的makefile的结构(2)
- 纯JAVA写的socket局域网斗地主游戏
- MySQL 中 INSERT 的一般用法
- boost库用property_tree读xml文件
- android生命周期(详细总结)
- SpringMVC访问静态资源的三种方式
- JAXB 中的@XmlElementWrapper注解生成问题
- 搭建基于Mac 的QT IOS开发环境
- 网络调试的几个命令
- 三列布局的几种方式
- eclipse导入工程错误(No projects are found to import)
- android四大组件总结