Lire la valeur ‘Int’ d’un Attribut

Author:

Utilisation,de,la,classe,'XmlTextReader',pour,lire,un,document,XML
{filelink=16395}

/*
  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 description for XmlUtil.
  /// 

  #endregion

  public class XmlUtil
  {

    #region GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)
    public static void GetIntAttrib(XmlNode node, string name, out bool found, out bool valid, ref int result)
    {
      if (node.Attributes == null || node.Attributes[name] == null)
      {
        found = false;
        valid = false;
        return;
      }

      found = true;
      valid = Int32.TryParse(node.Attributes[name].InnerText, out result);
    }
    #endregion

  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *