Example #1
0
 public Attr SetAttributeNodeNS(Attr attr) { throw new NotImplementedException(); }
Example #2
0
 public Attr RemoveAttributeNode(Attr attr) { throw new NotImplementedException(); }
Example #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;
        }
Example #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);
            }
        }
Example #5
0
        internal void RemoveAttribute(Attr attr)
        {
            AttributeList.Remove(attr);

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

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

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