当前位置:网站首页>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();
}边栏推荐
- 2022-7-6 Leetcode 977. Square of ordered array
- 2022-7-6 Leetcode 977.有序数组的平方
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
- [1] ROS2基础知识-操作命令总结版
- Detr introduction
- TPG x AIDU | AI leading talent recruitment plan in progress!
- Dry goods | summarize the linkage use of those vulnerability tools
- [daily training -- Tencent select 50] 231 Power of 2
- AI人才培育新思路,这场直播有你关心的
- 室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
猜你喜欢

实现IP地址归属地显示功能、号码归属地查询

Build a secure and trusted computing platform based on Kunpeng's native security

2022-7-6 Leetcode 977.有序数组的平方

2022-7-6 Leetcode 977. Square of ordered array

1. Deep copy 2. Call apply bind 3. For of in differences

DID登陆-MetaMask

交付效率提升52倍,运营效率提升10倍,看《金融云原生技术实践案例汇编》(附下载)

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

数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】

Detr introduction
随机推荐
供应链供需预估-[时间序列]
【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
Getting started with cinnamon applet
Show the mathematical formula in El table
DID登陆-MetaMask
The meaning of variables starting with underscores in PHP
实现IP地址归属地显示功能、号码归属地查询
Distributed transaction solution
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
Excerpt from "misogyny: female disgust in Japan"
How to make join run faster?
【日常训练】648. 单词替换
Getting started with MySQL
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
AI人才培育新思路,这场直播有你关心的
ROS机器人更换新雷达需要重新配置哪些参数
Environment configuration of lavarel env
PHP - laravel cache
Battle Atlas: 12 scenarios detailing the requirements for container safety construction