示例#1
0
 public Attr SetAttributeNodeNS(Attr attr) { throw new NotImplementedException(); }
示例#2
0
 public Attr RemoveAttributeNode(Attr attr) { throw new NotImplementedException(); }
示例#3
0
        public Attr SetAttributeNode(Attr attr)
        {
            if (attr.OwnerElement != null && attr.OwnerElement != this)
                throw new DomException(DomExceptionCode.InUseAttributeError);

            var old = GetAttributeNodeNS(attr.NamespaceUri, attr.LocalName);
            if (old != null)
                AttributeList.Remove(old);

            AttributeList.Add(attr);
            return old;
        }
示例#4
0
        public void SetAttribute(string qualifiedName, string value)
        {
            if (!XmlNameRegex.IsMatch(qualifiedName))
                throw new DomException(DomExceptionCode.InvalidCharacterError);

            if (OwnerDocument.IsHtmlDocument)
                qualifiedName = qualifiedName.ToLower();

            var attr = GetAttributeNode(qualifiedName);
            if (attr == null)
            {
                attr = new Attr(qualifiedName, value, this, OwnerDocument);
                AppendAttribute(attr);
            }
            else
            {
                ChangeAttribute(attr, value);
            }
        }
示例#5
0
        internal void RemoveAttribute(Attr attr)
        {
            AttributeList.Remove(attr);

            if (AttributeTokenLists.TryGetValue(attr.LocalName, out var list))
                list.Change();
        }
示例#6
0
        internal void ChangeAttribute(Attr attr, string value)
        {
            attr.Value = value;

            if (AttributeTokenLists.TryGetValue(attr.LocalName, out var list))
                list.Change();
        }
示例#7
0
        internal void AppendAttribute(Attr attr)
        {
            AttributeList.Add(attr);

            if (AttributeTokenLists.TryGetValue(attr.LocalName, out var list))
                list.Change();
        }