生成xml
#include "tinyxml2/tinyxml2.h"
void createXML(const char* pFileName)
{
//获取可写路径
std::string filePath = FileUtils::getInstance()->getWritablePath() + pFileName;
//项目资源目录
//filePath = FileUtils::getInstance()->getDefaultResourceRootPath() + pFileName;
//创建xml文档实例
tinyxml2::XMLDocument *pDoc = new tinyxml2::XMLDocument();
//xml 声明(参数可选)
//xml文件统一头部
XMLDeclaration *pDel = pDoc->NewDeclaration("xml version=\"1.0\" encoding=\"UTF-8\"");
//在pDoc文档尾部子节点添加一个节点(第一行)
pDoc->LinkEndChild(pDel);
//添加plist节点
//创建一个plis节点
XMLElement *plistElement = pDoc->NewElement("plist");
//设置节点属性
plistElement->SetAttribute("version", "1.0");
//将plist节点添加在文档当前尾部节点后面
pDoc->LinkEndChild(plistElement);
//创建一个注释
XMLComment *commentElement = pDoc->NewComment("this is xml comment");
//在plist节点里面的尾部节点后面添