当前位置:网站首页>Beginner XML
Beginner XML
2022-07-07 13:54:00 【Zheng 7013】
#include"XmlDocument.h"
#include<Windows.h>
std::string toString(const std::wstring str)
{
int len = WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, NULL, 0, NULL, NULL);
std::string ret;
if (len <= 0) return ret;
ret.resize(len);
WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, (char*)ret.c_str(), len, NULL, NULL);
return ret;
}
void xmlTest()
{
CoInitialize(NULL); //COM initialization
CXmlDocument doc;
BOOL ret = doc.Load(_T("FaceConfig.xml")); // Load the file
if (!ret)
{
std::cout << "load xml failed!" << std::endl;
}
CXmlNode root;
CXmlNode face;
ret = doc.SelectSingleNode(_T("/faceconfig"), root);
if (ret)
{
std::cout << "row:"<<root.GetAttributeInt(_T("row")) << std::endl;
std::cout << "col:" << root.GetAttributeInt(_T("col")) << std::endl;
std::cout << "item_width:" << root.GetAttributeInt(_T("item_width")) << std::endl;
std::cout << "item_height:" << root.GetAttributeInt(_T("item_height")) << std::endl;
std::cout << "zoom_width:" << root.GetAttributeInt(_T("zoom_width")) << std::endl;
std::cout << "zoom_height:" << root.GetAttributeInt(_T("zoom_height")) << std::endl;
ret = root.GetFirstChildNode(_T("face"),face);
while (ret)
{
std::cout << "[id]:"<< face.GetAttributeInt(_T("id")) << std::endl;
std::cout << "[tip]:"<< toString(face.GetAttribute(_T("tip"))) << std::endl;
std::cout << "[file]:"<< toString(face.GetAttribute(_T("file"))) << std::endl;
ret = face.GetNextSiblingNode(face);
}
}
face.Release();
root.Release();
doc.Release();
CoUninitialize();
}边栏推荐
- SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1
- Use of polarscatter function in MATLAB
- Help tenants
- Huawei image address
- Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
- FCOS3D label assignment
- 作战图鉴:12大场景详述容器安全建设要求
- 华为镜像地址
- Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
- 2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers
猜你喜欢

"New red flag Cup" desktop application creativity competition 2022

Getting started with MySQL

QQ medicine, Tencent ticket

High end for 8 years, how is Yadi now?

室内ROS机器人导航调试记录(膨胀半径的选取经验)

Use of polarscatter function in MATLAB

Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf

2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来

Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
![SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1](/img/10/6de1ee8467b18ae03894a8d5ba95ff.png)
SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1
随机推荐
Mysql怎样控制replace替换的次数?
Digital IC Design SPI
What parameters need to be reconfigured to replace the new radar of ROS robot
PostgreSQL array type, each splice
ES日志报错赏析-Limit of total fields
Solve the cache breakdown problem
属性关键字Aliases,Calculated,Cardinality,ClientName
2022-7-7 Leetcode 844. Compare strings with backspace
Redis只能做缓存?太out了!
Ways to improve the performance of raspberry pie
requires php ~7.1 -&gt; your PHP version (7.0.18) does not satisfy that requirement
搜索框效果的实现【每日一题】
Drawerlayout suppress sideslip display
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
接口自动化测试-接口间数据依赖问题解决
Talk about pseudo sharing
THINKPHP框架的优秀开源系统推荐
Fast development board pinctrl and GPIO subsystem experiment for itop-imx6ull - modify the device tree file
Evolution of customer service hotline of dewu
[daily training -- Tencent select 50] 231 Power of 2