代码拉取完成,页面将自动刷新
一个简单的、小的、并不高效、可能也不易用的XML解析器。大量借鉴了TinyXML-2。
从文件中读取XML,并解析
XMLDocument doc;
doc.loadFile("test.xml");
访问DOM树
XMLNode* node1 = doc.firstChild();
for(XMLNode* p = node1; p != nullptr; p = p->nextSibling()){
cout<<node1.getValue()<<endl;
}
node1.addLastChild(new XMLText("Test"));
delete node1.firstChild();
node1.removeFirstChild();
将DOM打印为XML文档
XMLPrinter printer(std::cout);
doc.accept(printer);
A simply, small, inefficient, and probably unusable XML parser. Borrowed many things from TinyXML-2.
Read XML from file and parse it.
XMLDocument doc;
doc.loadFile("test.xml");
Visit the DOM tree.
XMLNode* node1 = doc.firstChild();
for(XMLNode* p = node1; p != nullptr; p = p->nextSibling()){
cout<<node1.getValue()<<endl;
}
node1.addLastChild(new XMLText("Test"));
delete node1.firstChild();
node1.removeFirstChild();
Print DOM as XML document.
XMLPrinter printer(std::cout);
doc.accept(printer);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。