根据返回的XML语句 取值
XmlDocument doc = new XmlDocument();
try
{
doc.Load(Server.MapPath("XML1_1.xml"));
XmlNodeList nodes = doc.SelectSingleNode("delivers").ChildNodes;
int num = 0;
num = Convert.ToInt32(nodes[0].InnerText.ToString());
string id = string.Empty;
string content = string.Empty;
string phone = string.Empty;
if (num > 0)
{
for (int i = 1; i < nodes.Count; i++)
{
XmlNodeList nodess = nodes.Item(i).ChildNodes;
id = string.Empty;
content = phone = string.Empty;
phone = ((XmlElement)nodess[0]).FirstChild.Value;
id = ((XmlElement)nodess[1]).FirstChild.Value;
content = ((XmlElement)nodess[2]).FirstChild.Value;
Response.Write("<script>alert('" + phone + "\\n" + id + "\\n" + content + "\\n')</script>");
}
}
else
{
Response.Write("0");
}
}
catch
{
Response.Write("104");
}
精致的代码,精致的生活
例子:XML类