tinyxml是一個C++跨平台開源庫,XML檔案切記不要使用Windows記事本打開編輯,最好使用Notepad++進行編輯打開
生成文本:
<?xml version="1.0" encoding="UTF-8" ?>
<MyGUI type="Resource" version="1.1" />
生成代碼
TiXmlElement *RootElement = NULL;
TiXmlDocument *pDoc = NULL;
pDoc = new TiXmlDocument();
TiXmlDeclaration *pDeclaration = new TiXmlDeclaration(("1.0"), ("UTF-8"), (""));
pDoc->LinkEndChild(pDeclaration);
RootElement = new TiXmlElement(("MyGUI"));
RootElement->SetAttribute("type", "Resource");
RootElement->SetAttribute("version", "1.1");
pDoc->LinkEndChild(RootElement);
pDoc->SaveFile("fengyuzaitu51cto.xml");
delete pDoc;