This can be done using the XDocument (LINQ to XML) class. Assuming you have only one slide element:
Using simple XDocument navigation:
var doc = XDocument.Load("file path here"); if (doc.Root == null) throw new ArgumentException(); // No root node! var slideElement = doc.Root.Element("slide"); if (slideElement == null) throw new ArgumentException(); // No slide node! var values = string.Join(" ", slideElement.Elements().Select(element => element.Value));
Using XPath node selection:
var doc = XDocument.Load("file path here"); var slideElements = doc.XPathSelectElements("root/slide/*"); var values = string.Join(" ", slideElements.Select(element => element.Value));
source share