当前位置:网站首页>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();
}
边栏推荐
- ES日志报错赏析-Limit of total fields
- 供应链供需预估-[时间序列]
- Fast development board pinctrl and GPIO subsystem experiment for itop-imx6ull - modify the device tree file
- 高等数学---第八章多元函数微分学1
- [1] Basic knowledge of ros2 - summary version of operation commands
- Use of polarscatter function in MATLAB
- 为租客提供帮助
- My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
- Oracle advanced (V) schema solution
- Redis只能做缓存?太out了!
猜你喜欢
Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
提升树莓派性能的方法
DID登陆-MetaMask
118. 杨辉三角
How far can it go to adopt a cow by selling the concept to the market?
Custom thread pool rejection policy
Milkdown control icon
MySQL error 28 and solution
QQ medicine, Tencent ticket
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
随机推荐
Ikvm of toolbox Net project new progress
The meaning of variables starting with underscores in PHP
现在网上开户安全么?那么网上开户选哪个证券公司?
JS slow motion animation principle teaching (super detail)
使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
Data refresh of recyclerview
118. Yanghui triangle
高等数学---第八章多元函数微分学1
The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
Shell batch file name (excluding extension) lowercase to uppercase
社会责任·价值共创,中关村网络安全与信息化产业联盟对话网信企业家海泰方圆董事长姜海舟先生
QQ medicine, Tencent ticket
华为镜像地址
call undefined function openssl_cipher_iv_length
Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
mysql 局域网内访问不到的问题
室内ROS机器人导航调试记录(膨胀半径的选取经验)
Fast development board pinctrl and GPIO subsystem experiment for itop-imx6ull - modify the device tree file
TPG x AIDU | AI leading talent recruitment plan in progress!
Drawerlayout suppress sideslip display