• 4091阅读
  • 1回复

qt中怎样全新创建xml文件 [复制链接]

上一主题 下一主题
离线tan_tan_1
 
只看楼主 正序阅读 楼主  发表于: 2011-05-31
就像下面这样的
<?xml version="1.0" encoding="utf-8"?>
<PARAMETERS>
  <CmdType>2</CmdType>
  <ImgType>2</ImgType>
</PARAMETERS>
离线tan_tan_1
只看该作者 1楼 发表于: 2011-06-01
找到了    
    QDomElement root = doc.documentElement();
    QDomNodeList nodelist = root.childNodes();

    QDomProcessingInstruction instruction;
    instruction = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\"");
    doc.appendChild(instruction);

    QDomElement root = doc.createElement(QString("PARAMETERS"));
    doc.appendChild(root); //添加根元素
快速回复
限100 字节
 
上一个 下一个