62,025
社区成员
发帖
与我相关
我的任务
分享
string relativePath = System.Web.HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["SystemXmlDirectory"] + folderPath + "/");
string resultPath = "", splitstr1 = "", splitstr2 = "";
string fullFilePath = Path.Combine(relativePath, resultPath + ".xml");
bool result = false;
XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
XmlElement xmlelem;
if (Security.commonSystemFileExists(resultPath + ".xml", folderPath))
{
xmlDoc.Load(fullFilePath);
XmlNode root = xmlDoc.SelectSingleNode("Xmltables");//查找<Xmltables>
XmlElement xe1 = xmlDoc.CreateElement("TreeNode");//创建一个<Node>节点
if (type == "City")
{
City treeNode = tempData as City;
xe1.SetAttribute("id", treeNode.id.ToString());//设置该节点id属性
xe1.SetAttribute("name", treeNode.name);//设置该节点name属性
xe1.SetAttribute("provinceId", treeNode.provinceId.ToString());//设置该节点provinceId属性
xe1.SetAttribute("hotCity", treeNode.hotCity.ToString());//设置该节点hotCity属性
xe1.SetAttribute("orderid", treeNode.orderid.ToString());//设置该节点orderid属性
xe1.SetAttribute("number", treeNode.number.ToString());//设置该节点orderid属性
}
root.AppendChild(xe1);
result = true;
//保存创建好的XML文档
xmlDoc.Save(fullFilePath);
}