tinyxml2::XMLDocument iXmlDoc;
iXmlDoc.SaveFile(xmlPath, false);
这里SaveFile第二个参数为bool类型,可不传,为true时,保存的文件中不含‘\r','\n’,false相反,默认为false。
tinyxml2::XMLElement *pRoot = iXmlDoc.RootElement();
pRoot->InsertFirstChild(pElement2);
pRoot->InsertEndChild(pElement);
pRoot->InsertAfterChild(pElement, pElement3);
InsertFirstChild将元素插入到节点首,InsertEndChild将元素插入到节点尾,InsertAfterChild将元素插入到指定节点后面
未完待续...