System.Xml.XmlTextReaderImpl.AddDefaultAttributeInternal C# (CSharp) Method

AddDefaultAttributeInternal() private method

private AddDefaultAttributeInternal ( string localName, string ns, string prefix, string value, int lineNo, int linePos, int valueLineNo, int valueLinePos, bool isXmlAttribute ) : NodeData
localName string
ns string
prefix string
value string
lineNo int
linePos int
valueLineNo int
valueLinePos int
isXmlAttribute bool
return NodeData
        private NodeData AddDefaultAttributeInternal(string localName, string ns, string prefix, string value,
                                                     int lineNo, int linePos, int valueLineNo, int valueLinePos, bool isXmlAttribute)
        {
            // setup the attribute 
            NodeData attr = AddAttribute(localName, prefix, prefix.Length > 0 ? null : localName);
            if (ns != null)
            {
                attr.ns = ns;
            }

            attr.SetValue(value);
            attr.IsDefaultAttribute = true;
            attr.lineInfo.Set(lineNo, linePos);
            attr.lineInfo2.Set(valueLineNo, valueLinePos);

            // handle special attributes:
            if (attr.prefix.Length == 0)
            {
                // default namespace declaration
                if (Ref.Equal(attr.localName, _xmlNs))
                {
                    OnDefaultNamespaceDecl(attr);
                    if (!_attrNeedNamespaceLookup)
                    {
                        // change element default namespace
                        Debug.Assert(_nodes[_index].type == XmlNodeType.Element);
                        if (_nodes[_index].prefix.Length == 0)
                        {
                            _nodes[_index].ns = _xmlContext.defaultNamespace;
                        }
                    }
                }
            }
            else
            {
                // prefixed namespace declaration
                if (Ref.Equal(attr.prefix, _xmlNs))
                {
                    OnNamespaceDecl(attr);
                    if (!_attrNeedNamespaceLookup)
                    {
                        // change namespace of current element and attributes
                        string pref = attr.localName;
                        Debug.Assert(_nodes[_index].type == XmlNodeType.Element);
                        for (int i = _index; i < _index + _attrCount + 1; i++)
                        {
                            if (_nodes[i].prefix.Equals(pref))
                            {
                                _nodes[i].ns = _namespaceManager.LookupNamespace(pref);
                            }
                        }
                    }
                }
                // xml: attribute
                else
                {
                    if (isXmlAttribute)
                    {
                        OnXmlReservedAttribute(attr);
                    }
                }
            }

            _fullAttrCleanup = true;
            return attr;
        }
XmlTextReaderImpl