1 /// <summary>
2 /// 获取XML结点值
3 /// </summary>
4 /// <param name="Str">xml,如:XmlNodeList[0].InnerXml</param>
5 /// <param name="xPath">结点,如:time这个结点</param>
6 /// <returns>值</returns>
7 public static string get_Str_Nodes(string Str, string xPath)
8 {
9 int x = 0, y = 0, z = 0;
10 x = Str.IndexOf("<" + xPath + ">");
11 y = Str.IndexOf("</" + xPath + ">");
12 z = xPath.Length + 2;
13 if (y > x)
14 {
15 return Str.Substring(x + z, y - x - z).Trim();
16 }
17 else
18 {
19 return "";
20 }
21 }