SetAttribute() public méthode

给xPath匹配到的第一个节点追加属性. 对于该节点已存在的属性,将会覆盖这个属性的值
public SetAttribute ( string xPath, string>.IDictionary attributes ) : bool
xPath string xPath表达式
attributes string>.IDictionary 属性集合
Résultat bool
        public XmlElement GetAuthElement()
        {
            XmlHelper h = new XmlHelper("<Authentication />");
            h.SetAttribute(".", "Extends", Type.ToString());


            if (dgRestrict.Rows.Count > 0 || dgExt.Rows.Count > 0)
                h.AddElement(".", "UserInfoProcessors");

            if (dgRestrict.Rows.Count > 0)
            {
                XmlElement xml = h.AddElement("UserInfoProcessors", "Processor");
                xml.SetAttribute("Type", "restrict");

                XmlHelper xh = new XmlHelper(xml);
                foreach (DataGridViewRow row in this.dgRestrict.Rows)
                {
                    XmlElement res = row.Tag as XmlElement;
                    xh.AddElement(".", res);
                }
            }

            foreach (DataGridViewRow row in this.dgExt.Rows)
            {
                XmlElement xml = h.AddElement("UserInfoProcessors", "Processor");
                xml.SetAttribute("Type", "ExtendProperty");

                XmlHelper xh = new XmlHelper(xml);

                XmlElement res = row.Tag as XmlElement;
                xh.AddElement(".", res);
            }

            return h.GetElement(".");
        }