Read XML String to XML Nodes - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

Read XML String to XML Nodes

Demo Code


using System.Xml;
using System.Collections.Generic;

public class Main{
        public static IEnumerable<string> ReadNodes(this string xml, string nodeXPath)
        {//from www. ja v  a  2  s. co m
            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(xml);

            foreach (XmlNode node in xmlDocument.SelectNodes(nodeXPath))
            {
                yield return node.InnerText;
            }
        }
}

Related Tutorials