我有一个这样的XML文件:
<studentsform>
<student Studentname="srikanth" Address="1-66-1" SSC_marks="75%" Inter_marks="82%" Btech_marks="65%" Mailid="srikanth.togara@gmail.com"/>
</studentsform>
我怎样才能把这个XML文件读入qt设计器的行编辑中
请帮助我
解析 xml 文件相当容易,但这不是一个微不足道的答案。查看此处以获取有关如何解析 xml 文件的一些说明。
对于特定的读取(假设您已移动到文件中的正确位置),您可以使用如下内容:
// Get and attribute with name 'Studentname', currentPos is a QDomElement*
QString retVal = currentPos->attribute("Studentname", "");
或者,您可以获取所有属性并使用以下命令手动解析它们:
QDomNamedNodeMap attrMap = currentPos->attributes();