解析 XML 和 INI

XML

1.TinyXML库

TinyXML是一个C++的XML解析库 

使用介绍:

https://www.cnblogs.com/mythou/archive/2011/11/27/2265169.html   

使用的时候,只要把

tinyxml.h、tinystr.h、tinystr.cpp、tinyxml.cpp、tinyxmlerror.cpp、tinyxmlparser.cpp

这六个文件导入工程,然后#include ” tinyxml.h”就可以使用。

2.XML介绍

XML 可扩展标记语言 ,用来传送和携带数据信息(vs html 用来展示数据)     

XML 文档内容 分成 标记 + 内容
 

标记: 以<开头,以>结尾。不是标记的东西就是内容
一个标记结构称为tag标签。形式有如下三种:

  •             start-tag:            如<section>;
  •             end-tag:            如</section>;
  •             empty-element tag:    如<line-break />.


元素:     在start-tag与匹配的end-tag,例如: <greeting>Hello, world!</greeting>
             作为一个empty-element tag,例如: <line-break />

属性:    在start-tag 内部的“名字-值对”,例如:。<person name=haha>
            在empty-element tag 内部的“名字-值对”,例如:<img src="madonna.jpg" alt="Madonna" />

每个元素中,一个属性最多出现一次,一个属性只能有一个值

XML 文档的组织结构就是由一棵元素树组成的,整个文档就是一个根元素

3.DOM document object model 文档对象模型

用来解析结构化文档的(xml, html)

https://blog.csdn.net/qq_15037231/article/details/76396322

https://docs.microsoft.com/zh-cn/dotnet/standard/data/xml/xml-document-object-model-dom

https://developer.mozilla.org/zh-CN/docs/Web/API/Document_Object_Model/Introduction


      

读取INI配置文件

GetPrivateProfileString 函数用于获取INI配置文件中的内容
    读取 ini 文件

发布了104 篇原创文章 · 获赞 44 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/u012138730/article/details/97766503
今日推荐