Get Attribute from XmlNode - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get Attribute from XmlNode

Demo Code

// This is free software licensed under the NUnit license. You may
using System.Xml;
using System.Collections.Generic;
using System;/*w ww .  j ava  2 s  .co m*/

public class Main{
        #region Attributes

        public static string GetAttribute(XmlNode node, string name)
        {
            XmlAttribute attr = node.Attributes[name];
            return attr == null ? null : attr.Value;
        }
}

Related Tutorials