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);
}
}