示例#1
0
 /// <summary>
 /// Copies the attributes from the source element to the target
 /// element. Each attribute will be recreated on the target.
 /// </summary>
 /// <param name="source">The source of the attributes.</param>
 /// <param name="target">
 /// The target where to create the attributes.
 /// </param>
 protected static void CopyAttributes(Element source, Element target)
 {
     foreach (var attribute in source._attributes)
     {
         var attr = new Attr(attribute.Prefix, attribute.LocalName, attribute.Value, attribute.NamespaceUri);
         target._attributes.FastAddItem(attr);
     }
 }
示例#2
0
        internal void RaiseChangedEvent(Attr attr, String newValue, String oldValue)
        {
            var element = default(Element);

            if (_owner.TryGetTarget(out element))
            {
                element.AttributeChanged(attr.LocalName, attr.NamespaceUri, oldValue, newValue);
            }
        }
示例#3
0
        /// <summary>
        /// Adds all given attributes to the element, without any duplicate checks.
        /// </summary>
        /// <param name="element">The node with the target attributes.</param>
        /// <param name="attributes">The attributes to set.</param>
        public static void SetAttributes(this Element element, List<KeyValuePair<String, String>> attributes)
        {
            var container = element.Attributes;

            for (var i = 0; i < attributes.Count; i++)
            {
                var attribute = attributes[i];
                var item = new Attr(attribute.Key, attribute.Value);
                container.FastAddItem(item);
            }
        }
示例#4
0
        protected void CloneElement(Element element, Boolean deep)
        {
            CloneNode(element, deep);

            foreach (var attribute in _attributes)
            {
                var attr = new Attr(attribute.Prefix, attribute.LocalName, attribute.Value, attribute.NamespaceUri);
                element._attributes.FastAddItem(attr);
            }

            element.SetupElement();
        }
示例#5
0
 internal void FastAddItem(Attr attr)
 {
     _items.Add(attr);
 }
示例#6
0
 /// <summary>
 /// Copies the attributes from the source element to the target
 /// element. Each attribute will be recreated on the target.
 /// </summary>
 /// <param name="source">The source of the attributes.</param>
 /// <param name="target">
 /// The target where to create the attributes.
 /// </param>
 protected static void CopyAttributes(Element source, Element target)
 {
     foreach (var attribute in source._attributes)
     {
         var attr = new Attr(attribute.Prefix, attribute.LocalName, attribute.Value, attribute.NamespaceUri);
         target._attributes.FastAddItem(attr);
     }
 }
示例#7
0
 /// <summary>
 /// Adds an attribute.
 /// </summary>
 /// <param name="attr">The attribute to add.</param>
 public void AddAttribute(Attr attr)
 {
     _attributes.FastAddItem(attr);
 }