Modifier la valeur d’un attribut

Author:

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

    using System;
    using System.Text;
    using System.Xml;

/*
 *  Suivre la licence de ce produit sur la référence suivante:
 * GNU General Public License version 2 (GPLv2)
   http://cbasetest.codeplex.com/license
 *
 */

class ModifierValeurAttribut
{

        public static void ModifierLaValeurDAttribut(XmlNode noeud, string nom, object valeur)
        {
            ModifierLaValeurDAttribut(noeud, nom, valeur, null);
        }

        public static void ModifierLaValeurDAttribut(XmlNode noeud, string nom, string valeur)
        {
            XmlAttribute node = noeud.OwnerDocument.CreateAttribute(nom);
            noeud.Attributes.Append(node);
            node.Value = valeur;
        }

        public static void ModifierLaValeurDAttribut(XmlNode noeud, string nom, object valeur, string nomParDefaut)
        {
            string str = nomParDefaut;
            if (valeur != null)
            {
                str = valeur.ToString();
            }
            if (str != null)
            {
                ModifierLaValeurDAttribut(noeud, nom, str);
            }
        }

}

Leave a Reply

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