Get XML Element - CSharp System.Xml

CSharp examples for System.Xml:XML Element

Description

Get XML Element

Demo Code


using System.Xml.XPath;
using System.Xml;
using System.Text;
using System.IO;//from   w  ww .  ja v  a2 s  .c om
using System;

public class Main{
        #endregion

        #region GetElement

        public static XmlElement GetElement(XmlElement parentElement, string tagName)
        {
            var list = parentElement.GetElementsByTagName(tagName);
            if (list.Count > 0)
                return (XmlElement) list[0];
            else
                return null;
        }
}

Related Tutorials