Get XML Node - CSharp System.Xml

CSharp examples for System.Xml:XML Node

Description

Get XML Node

Demo Code


using System.Xml.XPath;
using System.Xml;
using System.Text;
using System.IO;//from   www  .  j  a v a2 s  .c o m
using System;

public class Main{
        public static System.Xml.XmlNode GetNode(System.Xml.XmlNode xmlNode, string XPath, XmlNamespaceManager nsManager)
        {
            try
            {
                System.Xml.XmlNode node = null;
                node = xmlNode.SelectSingleNode(XPath, nsManager);
                return node;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        #endregion

        #region GetNode

        public static System.Xml.XmlNode GetNode(System.Xml.XmlNode xmlNode, string XPath)
        {
            try
            {
                System.Xml.XmlNode node = null;
                node = xmlNode.SelectSingleNode(XPath);
                return node;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
}

Related Tutorials