I am working on a text summarization method ,for test my method i have a benchmark called doc 2007
,inside this benchmark i have a lot of xml file ,i should cle
XElment.Parse only use in String with single root node. The instance you wrote have two nodes '' without one root node. You can add a root node like below:
xml = "<root>" + xml + "</root>";
Using LINQ to XML should be easier:
var res = XElement.Parse(xml)
.Descendants("sentence").Where(e => e.Attribute("id").Value == "s0")
.FirstOrDefault().Value;
or, as Yeldar suggested, the cleaner way would be:
var s0 = XElement.Parse(xml)
.Descendants("sentence").FirstOrDefault(e => e.Attribute("id").Value == "s0")
.Value;