Follow Path from XmlNode - CSharp System.Xml

CSharp examples for System.Xml:XML Node

Description

Follow Path from XmlNode

Demo Code


using System.Xml;
using System.Text;
using System.Collections.Generic;
using System;// ww w .j  a  va 2s . c o  m

public class Main{
        public static XmlElement FollowPath(XmlNode source, params string[] tagNames)
        {
            XmlElement p = GetFirstChild(source, tagNames[0]);
            for (int i = 1; p != null && i < tagNames.Length; i++)
                p = GetFirstChild(p, tagNames[i]);
            return p;
        }
}

Related Tutorials