检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:王宏明 林卫永 王泉荣 温业中 Wang Hongming;Lin Weiyong;Wang Quanrong;Wen Yezhong(CRSC Wanquan Signal Equipment Co.,Ltd.,Hangzhou 310000,China)
出 处:《铁路通信信号工程技术》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[交通运输工程—道路与铁道工程]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:216.73.216.170