当前位置:网站首页>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();
}
边栏推荐
- Battle Atlas: 12 scenarios detailing the requirements for container safety construction
- call undefined function openssl_cipher_iv_length
- ES日志报错赏析-Limit of total fields
- 得物客服热线的演进之路
- Distributed transaction solution
- Problems that cannot be accessed in MySQL LAN
- [daily training] 648 Word replacement
- Laravel Form-builder使用
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
- Dry goods | summarize the linkage use of those vulnerability tools
猜你喜欢
1. Deep copy 2. Call apply bind 3. For of in differences
Help tenants
Navicat run SQL file import data incomplete or import failed
SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1
. Net core about redis pipeline and transactions
2022-7-6 Leetcode 977.有序数组的平方
Milkdown control icon
2022-7-6 beginner redis (I) download, install and run redis under Linux
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
随机推荐
Mysql怎样控制replace替换的次数?
The meaning of variables starting with underscores in PHP
Navicat run SQL file import data incomplete or import failed
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
[QNX hypervisor 2.2 user manual]6.3.4 virtual register (guest_shm.h)
PC端页面如何调用QQ进行在线聊天?
2022-7-6 beginner redis (I) download, install and run redis under Linux
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
Ikvm of toolbox Net project new progress
提升树莓派性能的方法
Redis只能做缓存?太out了!
Lavarel之环境配置 .env
Esp32 series column
postgresql array类型,每一项拼接
648. Word replacement: the classic application of dictionary tree
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
THINKPHP框架的优秀开源系统推荐
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours
得物客服热线的演进之路
带你掌握三层架构(建议收藏)