-
xml写代码
- #include <QDomDocument>
- #include <QtGui>
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
-
- QDomDocument doc;
- QDomNode instruction = doc.createProcessingInstruction("xml","version = "1.0" encoding = " UTF-8"");
- doc.appendChild(instruction);
- QDomElement root = doc.createElement("Notes");
-
- doc.appendChild(root);
-
- QDomElement note = doc.createElement("note");
-
- root.appendChild(note);
-
- QDomElement no = doc.createElement("no");
-
- note.appendChild(no);
-
- QDomText no_text = doc.createTextNode("001");
-
- no.appendChild(no_text);
-
- QFile file("test.xml");
-
- if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate |QIODevice::Text))
-
- return 1 ;
-
- QTextStream out(&file);
-
- out.setCodec("UTF-8");
-
- doc.save(out,4,QDomNode::EncodingFromTextStream);
-
- file.close();
-
-
-
- return a.exec();
- }
-
相关阅读:
Spring MVC
Spring
MyBatis
Java Listener
Java Filter
JSTL
EL
pyltp安装
美团面经-java开发
oppo面经-java开发
-
原文地址:https://www.cnblogs.com/lvdongjie/p/4102526.html
Copyright © 2020-2023
润新知