当前位置:网站首页>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();
}边栏推荐
- 【堡垒机】云堡垒机和普通堡垒机的区别是什么?
- Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
- What are the principles for distinguishing the security objectives and implementation methods that cloud computing security expansion requires to focus on?
- 华为镜像地址
- High end for 8 years, how is Yadi now?
- call undefined function openssl_ cipher_ iv_ length
- 2022-7-7 Leetcode 844. Compare strings with backspace
- 2022-7-6 Leetcode 977.有序数组的平方
- Milkdown control icon
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
猜你喜欢

Custom thread pool rejection policy

Milkdown control icon

Getting started with MySQL

Show the mathematical formula in El table

Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)

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

室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)

MySQL error 28 and solution

Digital IC Design SPI

Thread pool reject policy best practices
随机推荐
Data refresh of recyclerview
Error lnk2019: unresolved external symbol
JS slow motion animation principle teaching (super detail)
move base参数解析及经验总结
PC端页面如何调用QQ进行在线聊天?
Lavarel之环境配置 .env
LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值
LeetCode简单题分享(20)
AI人才培育新思路,这场直播有你关心的
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
Redis只能做缓存?太out了!
MySQL error 28 and solution
Leetcode simple question sharing (20)
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
[daily training -- Tencent select 50] 231 Power of 2
Ikvm of toolbox Net project new progress
Esp32 ① compilation environment
The meaning of variables starting with underscores in PHP
TPG x AIDU | AI leading talent recruitment plan in progress!
Help tenants