基于QT的XML文件自动转换方法  被引量:2

QT-based Automatic Conversion Method of XML Files

在线阅读下载全文

作  者:王宏明 林卫永 王泉荣 温业中 Wang Hongming;Lin Weiyong;Wang Quanrong;Wen Yezhong(CRSC Wanquan Signal Equipment Co.,Ltd.,Hangzhou 310000,China)

机构地区:[1]通号万全信号设备有限公司,杭州310000

出  处:《铁路通信信号工程技术》2021年第2期88-92,共5页Railway Signalling & Communication Engineering

摘  要:为简单方便的将XML文件转换为C++的对象实例,提出一种将XML文件和C++对象之间互相转换的方法。研究XML文件的结构和Q T的元类型系统,以XML根节点为开始,采用深度优先读取算法遍历XML文件的每个节点,将节点内容和节点属性组装到C++对象实例,保留XML文件的元素间的嵌套关系,可以根据该关系读取整个XML文档,也可以根据需要只读取对应节点的内容。最后通过实例验证该方法的正确性和有效性,演示该方法的简单、高效。In order to convert XML files into object instances of C++,this paper presents an interconversion method between XML files and C++objects.The structure of XML file and the metatype system of QT are studied.Starting with the XML root node,each node of XML file is traversed by depth-fi rst reading algorithm.The content and attributes of node are assembled into C++object instances.The nested relationship among elements of XML fi le is preserved.The whole XML fi le can be read according to this relationship,or only the content of the corresponding node can be read as needed.Finally,an example is given to verify the correctness and validity of the method and demonstrate its simplicity and effi ciency.

关 键 词:可扩展标记语言 XML QT 转换  C++ 动态实例 元类型系统 

分 类 号:U239.3[交通运输工程—道路与铁道工程]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象