Xml读写笔记
1 #region getXML
2 string path = "ORDER20100407133247.XML";
3
4 if (HttpContext.Current != null)
5 {
6 path = HttpContext.Current.Server.MapPath(path);
7 }
8
9 System.IO.StreamReader sr = new System.IO.StreamReader(path, System.Text.Encoding.GetEncoding("utf-8"));
10 sr.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);
11 string s = "";
12
13 while (sr.Peek() > -1)
14 {
15 s += sr.ReadLine();
16 }
17
18 sr.Close();
19
20 XmlDocument doc = new XmlDocument();
21 doc.LoadXml(s);
22 #endregion
XmlNodeList _nl = doc.GetElementsByTagName("Start").Item(0).SelectNodes("PACKLIST");pkl.OrderNo = nd.SelectSingleNode("ORDER_NO").InnerXml;