Given the following:
<Query>
<Where>
<Eq>
<FieldRef Name=\"ID\" />
<Value Type=\"Title\">
1
</Value>
</Eq>
开发者_开发问答</Where>
</Query>
How can I, via using XElement (LINQ to XML):
1) Select the title word (to change it)?
2) Get the 1 value (to change it)?
Thanks
string xml = @"<Query>
<Where>
<Eq>
<FieldRef Name=""ID"" />
<Value Type=""Title"">
1
</Value>
</Eq>
</Where>
</Query>";
var el = XElement.Parse(xml);
var value = el.Descendants("Value").FirstOrDefault();
value.Attribute("Type").Value = "abcdef";
value.Value = "ghijkl";
string newXml = el.ToString();
精彩评论