I need to cycle a XML node called "Query" and pull the InnerText of all <Sql> or <StoreProcedure> notes underneath them.
There could be 10 <Sql> or <StoredProcedure> nodes underneath.
What is the best way to do that using LINQ?
I have this so far:
XmlNodeList nodes = root.SelectNodes("//Query");
foreach (XmlNode item in nodes) { if (item != null) { if (item.FirstChild != null) { if (string.IsNullOrWhiteSpace(item.FirstChild.Name) == false) { if (item.FirstChild.Name == "Sql") { } } } } }