asp.net 操作xml(5) } xmlDoc.Save(Server.MapPath("user.xml"));//保存 }
private void showIt() { LoadXml(); XmlNode xn=xmlDoc.SelectSingleNode("user"); XmlNodeList xnl=xn.ChildNodes; foreach(XmlNode xnf in xnl) { XmlElement xe=(XmlElement)xnf;// Console.WriteLine(xe.GetAttribute("name"));//显示属性值// Console.WriteLine(xe.GetAttribute("sex"));// // XmlNodeList xnf1=xe.ChildNodes;// foreach(XmlNode xn2 in xnf1)// {// Console.WriteLine(xn2.InnerText);//显示子节点点文本// }
}