FindNodeOffsetNS() private method

private FindNodeOffsetNS ( XmlAttribute node ) : int
node XmlAttribute
return int
Exemplo n.º 1
0
        private void CloseWithAppendAttribute()
        {
            XmlElement?elem = _start as XmlElement;

            Debug.Assert(elem != null);
            XmlAttributeCollection attrs = elem.Attributes;

            for (int i = 0; i < _fragment.Count; i++)
            {
                XmlAttribute?attr = _fragment[i] as XmlAttribute;
                Debug.Assert(attr != null);
                int offset = attrs.FindNodeOffsetNS(attr);
                if (offset != -1 &&
                    ((XmlAttribute)attrs.nodes[offset]).Specified)
                {
                    throw new XmlException(SR.Xml_DupAttributeName, attr.Prefix.Length == 0 ? attr.LocalName : $"{attr.Prefix}:{attr.LocalName}");
                }
            }
            for (int i = 0; i < _fragment.Count; i++)
            {
                XmlAttribute?attr = _fragment[i] as XmlAttribute;
                Debug.Assert(attr != null);
                attrs.Append(attr);
            }
        }
        private void CloseWithAppendAttribute()
        {
            XmlElement elem = start as XmlElement;

            Debug.Assert(elem != null);
            XmlAttributeCollection attrs = elem.Attributes;

            for (int i = 0; i < fragment.Count; i++)
            {
                XmlAttribute attr = fragment[i] as XmlAttribute;
                Debug.Assert(attr != null);
                int offset = attrs.FindNodeOffsetNS(attr);
                if (offset != -1 &&
                    ((XmlAttribute)attrs.Nodes[offset]).Specified)
                {
                    throw new XmlException(Res.Xml_DupAttributeName, attr.Prefix.Length == 0 ? attr.LocalName : string.Concat(attr.Prefix, ":", attr.LocalName));
                }
            }
            for (int i = 0; i < fragment.Count; i++)
            {
                XmlAttribute attr = fragment[i] as XmlAttribute;
                Debug.Assert(attr != null);
                attrs.Append(attr);
            }
        }
        private void CloseWithAppendAttribute()
        {
            XmlElement             start      = this.start as XmlElement;
            XmlAttributeCollection attributes = start.Attributes;

            for (int i = 0; i < this.fragment.Count; i++)
            {
                XmlAttribute node = this.fragment[i] as XmlAttribute;
                int          num2 = attributes.FindNodeOffsetNS(node);
                if ((num2 != -1) && ((XmlAttribute)attributes.Nodes[num2]).Specified)
                {
                    throw new XmlException("Xml_DupAttributeName", (node.Prefix.Length == 0) ? node.LocalName : (node.Prefix + ":" + node.LocalName));
                }
            }
            for (int j = 0; j < this.fragment.Count; j++)
            {
                XmlAttribute attribute2 = this.fragment[j] as XmlAttribute;
                attributes.Append(attribute2);
            }
        }