当前位置:网站首页>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();
}边栏推荐
- JS slow motion animation principle teaching (super detail)
- 高等数学---第八章多元函数微分学1
- How to make join run faster?
- 【堡垒机】云堡垒机和普通堡垒机的区别是什么?
- Deep understanding of array related problems in C language
- Es log error appreciation -limit of total fields
- Laravel form builder uses
- Introduction and basic use of stored procedures
- "New red flag Cup" desktop application creativity competition 2022
- 2022-7-6 Leetcode 977.有序数组的平方
猜你喜欢

566. 重塑矩阵

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

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

QQ medicine, Tencent ticket

Did login metamask

How far can it go to adopt a cow by selling the concept to the market?

Show the mathematical formula in El table

Milkdown control icon

Redis can only cache? Too out!
![Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]](/img/35/5224252624cc76f42cbd0fd5c81d8c.png)
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
随机推荐
[daily training -- Tencent select 50] 231 Power of 2
118. Yanghui triangle
. Net core about redis pipeline and transactions
华为镜像地址
Data refresh of recyclerview
干货|总结那些漏洞工具的联动使用
Getting started with cinnamon applet
[1] ROS2基础知识-操作命令总结版
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
QQ medicine, Tencent ticket
SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
搜索框效果的实现【每日一题】
Es log error appreciation -limit of total fields
requires php ~7.1 -&gt; your PHP version (7.0.18) does not satisfy that requirement
566. Reshaping the matrix
2022-7-7 Leetcode 844. Compare strings with backspace
10 pictures open the door of CPU cache consistency
高等数学---第八章多元函数微分学1
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Redis只能做缓存?太out了!