首页 > 编程知识 正文

库乐队音乐剪辑方法(香蕉库的使用方法)

时间:2023-05-06 21:26:44 阅读:75433 作者:2740

TinyXml下载链接: https://pan.baidu.com/s/1kXiTFSF

要使用TinyXML,请将六个文件: tinyxml.h、tinystr.h、tinystr.cpp、tinyxml.cpp、tinyxml.cpp和tinyxmlerror.cpp添加到项目中

TinyXml类介绍:

XML base :整个tinyxml模型的基类;

XML attribute :与XML中的元素对应的属性;

XML comment :支持XML中的评论;

XML declaration :支持XML的hmdxn部分,也就是说? 版本=' 1.0 '?

XML文档:整个与XML对应的文档;

XML文档:整个与XML对应的文档;

xmltext :与XML对应的文本部分;

XML unknown :对应于XML的未知部分;

XML处理程序:定义了对XML的一些操作;

注意:元素必须是节点,节点不必是元素。

一:加载XML文件

//XML文件加载//XML文档doc; if (! doc.loadfile(test.XML ) ) { qDebug )“XML文件加载失败”; const char * errorstr=doc.error desc (; qDebug () errorStr; //打印失败的理由}

2 :获取XML的根节点

//XML文件加载//XML文档doc; if (! doc.loadfile(test.XML ) ) { qDebug ) )“XML文件加载失败”const char * errorstr=doc.error desc (; qDebug () errorStr; //打印失败的原因} else { //根节点元素tixmlelement * root=doc.first child element (; }

三.常用方法

ti XML文档doc; doc.loadfile(test.XML ); tixmlelement * root=doc.first child element (; //根节点元素qstring element name=根值(; //元素名称bool Children=root-NoChildren (; //判断该元素是否有子元素并返回true,false中包含tixmlelement * child=root-first child element (; 获取root元素下的第一个子元素child=root-first child element (' major ' )//获取根元素的子元素获取元素名称(major ) tixmlelement * brother=child-nexeld 获取child元素的下一个同级元素brother=child-next sibling element (' specversion ' ); child元素的同级元素指定元素名称(specVersion ) QString text=brother-GetText ); brother元素的值tixmlattribute * attribute=brother-first attribute (; brother元素的第一个属性qstring attributename=attribute-name (; Attribute属性的名称qstringattributevalue=attribute-value (); Attribute属性的值attribute value=brother-attribute (' attributename ); 获取brother的属性名称(AttributeName )的值

ti XML document * my document=newtixmldocument (; //XML文件tixmldeclaration * p declaration=newtixmldeclaration (' 1.0 ',' UTF-8 ',''); 创建//XML文件标头? XML版本=' 1.0 '编码=' utf-8 '? )我的文档-链接Undchild (p declaration; //添加将xml文件标头添加到文档的tixmlelement * business=newtixmlelement (' business ); //创建元素节点my document-linkendchild (业务); 将业务元素节点添加到文档的tixmlelement * country=newtixmlelement (' country );//创建两个节点tixmlelement * planet=newtixmlelement (planet ); business-LinkendChild(planet ); //将新节点添加到业务的下一个业务链接字段(country )中; ti xmltext * planet txt=newtixmltext (' one ); //添加节点中的文本ti xmltext * country txt=newtixmltext (' China ' ); country-linkendchild (country txt; planet-Linkendchild(planettxt; 我的文档-保存文件(test.XML ); //XML保存

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。