XML Parsing

XmlTextReader xmlTextReader = new XmlTextReader(new StringReader(xml)); //pass xml string XPathDocument xDoc = new XPathDocument(xmlTextReader); XPathNavigator xNav = xDoc.CreateNavigator(); XPathNodeIterator xNode = xNav.Select(strNode); foreach (XPathNavigator parentNode in xNav.Select(strNode)) foreach (XPathNavigator childNode in parentNode.SelectChildren(XPathNodeType.All)) dictionary.Add(childNode.Name, childNode.Value.Trim()); //store in dictionary object
Code for getting node names and values and storing in dictionary based on the root node value passed.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.