1 private void CreateXMLFile(string pathAndFileName) 2 { 3 XmlDocument doc = new XmlDocument(); 4 XmlElement rootElementUser,subElementUserID,subElementXMID; 5 6 XmlNode node = doc.CreateXmlDeclaration("1.0","utf-8","no"); 7 doc.AppendChild(node); 8 9 rootElementUser = doc.CreateElement("user"); 10 doc.AppendChild(rootElementUser); 11 12 subElementUserID = doc.CreateElement("userID"); 13 XmlText userID = doc.CreateTextNode(XiangMuGG.Userintid.ToString()); 14 subElementUserID.AppendChild(userID); 15 rootElementUser.AppendChild(subElementUserID); 16 17 subElementXMID = doc.CreateElement("xmID"); 18 XmlText xmID = doc.CreateTextNode(XiangMuGG.xmid.ToString()); 19 subElementXMID.AppendChild(xmID); 20 rootElementUser.AppendChild(subElementXMID); 21 22 doc.Save(pathAndFileName); 23 }