当前位置:网站首页>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.有序数组的平方
- 【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
- flask session伪造之hctf admin
- Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
- 2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
- Esp32 construction engineering add components
- call undefined function openssl_ cipher_ iv_ length
- Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
- JS function returns multiple values
- 参数关键字Final,Flags,Internal,映射关键字Internal
猜你喜欢

How to make join run faster?

AI人才培育新思路,这场直播有你关心的

Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)

Custom thread pool rejection policy

为租客提供帮助
![[dark horse morning post] Huawei refutes rumors about](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[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

"New red flag Cup" desktop application creativity competition 2022

2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out

2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置

Talk about pseudo sharing
随机推荐
Toraw and markraw
Build a secure and trusted computing platform based on Kunpeng's native security
How far can it go to adopt a cow by selling the concept to the market?
SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
内存溢出和内存泄漏的区别
Solve the cache breakdown problem
Esp32 construction engineering add components
Drawerlayout suppress sideslip display
【日常训练】648. 单词替换
118. 杨辉三角
Environment configuration of lavarel env
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
Flink | 多流转换
2022-7-7 Leetcode 844. Compare strings with backspace
Distributed transaction solution
xshell连接服务器把密钥登陆改为密码登陆
Did login metamask
move base参数解析及经验总结