当前位置:网站首页>初学XML
初学XML
2022-07-07 10:45:00 【郑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初始化
CXmlDocument doc;
BOOL ret = doc.Load(_T("FaceConfig.xml")); //加载文件
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();
}边栏推荐
- test
- MySQL导入SQL文件及常用命令
- [statistical learning method] learning notes - support vector machine (I)
- 谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
- [statistical learning methods] learning notes - Chapter 5: Decision Tree
- 2022广东省安全员A证第三批(主要负责人)考试练习题及模拟考试
- opencv的四个函数
- 【二叉树】删点成林
- 图像像素读写操作
- [learn microservice from 0] [01] what is microservice
猜你喜欢

Image pixel read / write operation
![[pytorch practice] use pytorch to realize image style migration based on neural network](/img/20/8ed7113115709b6169be289b0c280a.png)
[pytorch practice] use pytorch to realize image style migration based on neural network

Cookie

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics

Creation and assignment of graphic objects

MPLS experiment

Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)

2022聚合工艺考试题模拟考试题库及在线模拟考试

Day-14 common APIs

Master formula. (used to calculate the time complexity of recursion.)
随机推荐
The left-hand side of an assignment expression may not be an optional property access. ts(2779)
图形对象的创建与赋值
Day-16 set
Cookie
2022-07-07日报:GAN发明者Ian Goodfellow正式加入DeepMind
PHP调用纯真IP数据库返回具体地址
Session
货物摆放问题
广州市召开安全生产工作会议
《ASP.NET Core 6框架揭秘》样章[200页/5章]
在字符串中查找id值MySQL
2022 polymerization process test question simulation test question bank and online simulation test
Realize a simple version of array by yourself from
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
Object. Simple implementation of assign()
[learn wechat from 0] [00] Course Overview
Simple implementation of call, bind and apply
Master公式。(用于计算递归的时间复杂度。)
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
IPv6 experiment