编写xml文件

时间:2011-10-03 19:16:15

标签: c++ xml

假设我想写文件并将它们存储为xml文件。我怎么做?我之前从未处理过xml文件,我想知道你是怎么做的,如果你对从哪里开始有任何有用的评论!

提前致谢

2 个答案:

答案 0 :(得分:2)

如果您的意思是将XML写入文件,请写下来!

#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile;
  myfile.open ("test.xml");
  myfile << "<?xml version=\"1.0\" encoding=\"utf-8\"?><book></book>";
  myfile.close();
  return 0;
}

答案 1 :(得分:1)

在Windows上编写/读取XML文件的简单方法是使用XmlLite解析器:

"Small And Fast XML Parser For Native C++"

你也有工作samples from MSDN

相关问题