• 7062阅读
  • 3回复

QDomDocument对象如何保存QFile对象到硬盘文件 [复制链接]

上一主题 下一主题
离线vachin
 

只看楼主 倒序阅读 楼主  发表于: 2006-06-27
QDomDocument对象如何保存QFile对象到硬盘文件
如题,偶是新手!

谁能给段代码啊,谢谢
[ 此贴被XChinux在2006-06-27 19:08重新编辑 ]
离线vachin

只看该作者 1楼 发表于: 2006-07-20
^_^

QString fileName("sample");
QFile xmlFile(fileName + ".xml");

if(xmlFile.open(IO_WriteOnly))
{
QTextStream xmlStream(&xmlFile);
xmlStream.setEncoding(QTextStream::UnicodeUTF8);

QDomDocument xmlDoc;
QString strHead("version=\"1.0\" encoding=\"UTF-8\"");
xmlDoc.appendChild(svgDoc.createProcessingInstruction("xml", strHead));
xmlStream<<xmlDoc.toString();
}
xmlFile.close();
离线mishuang
只看该作者 2楼 发表于: 2006-10-29
svgDoc应该为xmlDoc,呵呵
离线cavendish

只看该作者 3楼 发表于: 2006-11-16
C++ GUI Programming with Qt 3
第14章XML
Writing XML一节
快速回复
限100 字节
 
上一个 下一个