是不是找到节点?还是找值?
public static string GetNodeValue(string xml,string value)
{
string val = string.Empty;
StringReader strreder = new StringReader(xml);
XmlTextReader txt = new XmlTextReader(strreder);
XDocument xdoc = XDocument.Load(txt);
var query = from q in xdoc.Descendants("Account1")
where q.Value == value
select new
{
Value = q.Value
};
foreach (var q in query)
{
val = q.Value;
break;
}
strreder.Close();
txt.Close();
return val;
}