Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to properly cycle a XML Node of "Query"

$
0
0

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")
                                        {
                                        }
                                    }
                                }
                            }
                        }


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>