I have a XML document that has many nodes, with children nodes and grandchildren nodes. I need to output all nodes into a NameValueCollection or Dictionary using C#.
The Xml looks like this:
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
The following seems to work for nodes that are direct children of the root node (ePolicy), but for grandchild nodes, it just combines them all into a single value.
Here's the output I'm getting:
The above XML is a sample from URLstring variable below:
qsCollection = new System.Collections.Specialized.NameValueCollection();
XmlTextReader reader = new XmlTextReader(URLstring);
XmlDocument xmlDoc = new XmlDocument();
XmlNodeList nodeList = xmlDoc.SelectNodes("ePolicy");
foreach (XmlElement node in xmlDoc.DocumentElement)