Get attribute from XmlNode : DOM « XML « C# / C Sharp






Get attribute from XmlNode

   

//Microsoft Public License (Ms-PL)
//http://dbmlmanager.codeplex.com/license

#region using
using System;
using System.Xml;
#endregion

namespace DbmlManager.Lib.Utility
{
  #region Class Docs
  /// <summary>
  /// Summary description for XmlUtil.
  /// </summary>
  #endregion

  public class XmlUtil
  {


    #region GetAttrib(XmlNode node, string name)
    public static string GetAttrib(XmlNode node, string name)
    {
      if (node.Attributes == null)
        return null;

      if (node.Attributes[name] == null)
        return null;

      return node.Attributes[name].InnerText;
    }
    #endregion

  }
}

   
    
    
  








Related examples in the same category

1.DOM feature check
2.Create Xml Document, Node
3.Load String from xml element
4.Load boolean value from xml element
5.Get integer value from xml element
6.Set Xml Node Value
7.Get Value String from Xml
8.Get InnerXml without changing the spacing
9.Get Inner Xml
10.Add Xml Element
11.Returns the InnerText value from a node or string.Empty if the node is null.
12.Sets the inner text in a node. If the node doesn't exist, it creates a new one and adds the text to it.