public override string GetAttribute (int attributeIndex)
{
if (NodeType == XmlNodeType.XmlDeclaration) {
XmlDeclaration decl = current as XmlDeclaration;
if (attributeIndex == 0)
return decl.Version;
else if (attributeIndex == 1) {
if (decl.Encoding != String.Empty)
return decl.Encoding;
else if (decl.Standalone != String.Empty)
return decl.Standalone;
}
else if (attributeIndex == 2 &&
decl.Encoding != String.Empty && decl.Standalone != null)
return decl.Standalone;
throw new ArgumentOutOfRangeException ("Index out of range.");
} else if (NodeType == XmlNodeType.DocumentType) {
XmlDocumentType doctype = current as XmlDocumentType;
if (attributeIndex == 0) {
if (doctype.PublicId != "")
return doctype.PublicId;
else if (doctype.SystemId != "")
return doctype.SystemId;
} else if (attributeIndex == 1)
if (doctype.PublicId == "" && doctype.SystemId != "")
return doctype.SystemId;
throw new ArgumentOutOfRangeException ("Index out of range.");
}
// This is MS.NET bug which returns attributes in spite of EndElement.
if (isEndElement || current == null)
return null;
if (attributeIndex < 0 || attributeIndex > AttributeCount)
throw new ArgumentOutOfRangeException ("Index out of range.");
return ownerLinkedNode.Attributes [attributeIndex].Value;
}