System.Xml.Linq.XmlHelper.RemoveAttribute C# (CSharp) Méthode

RemoveAttribute() public méthode

删除被xPath匹配的节点下的属性
public RemoveAttribute ( string xPath, string name ) : void
xPath string xPath表达式
name string 要移除的属性名
Résultat void
        public void RemoveAttribute(string xPath,string name)
        {
            var element = GetXElement(xPath);
            if (element == null) return;
            var attribute = element.Attribute(name);
            if (attribute == null) return;
            attribute.Remove();
        }