使用XPath查询获取节点后更改节点的值

  public int SetEclipse()
  {
   int ret = 0;
   XmlDocument doc = new XmlDocument();
   doc.Load("SystemSet.xml");
   XmlElement root = doc.DocumentElement ;
   XmlNode eclipse = root.SelectSingleNode("descendant::HaveEclipse[@key='runtime']");
   if (eclipse != null)
   {
    ret = int.Parse(eclipse.InnerXml) + 1000;
    eclipse.InnerXml = ret.ToString();
    doc.Save("SystemSet.xml") ;
   }
   return ret;
  }

你可能感兴趣的:(xpath)