public String GetAttribute( int attributeIndex ) {
if( this.bCreatedOnAttribute )
return null;
switch ( curNode.NodeType ) {
case XmlNodeType.Element:
CheckIndexCondition( attributeIndex );
return ((XmlElement)curNode).Attributes[attributeIndex].Value;
case XmlNodeType.Attribute :
CheckIndexCondition( attributeIndex );
return ((XmlElement)elemNode).Attributes[attributeIndex].Value;
case XmlNodeType.XmlDeclaration: {
CheckIndexCondition( attributeIndex );
return GetDeclarationAttr( attributeIndex );
}
case XmlNodeType.DocumentType: {
CheckIndexCondition( attributeIndex );
return GetDocumentTypeAttr( attributeIndex );
}
}
throw new ArgumentOutOfRangeException( "attributeIndex" ); //for other senario, AttributeCount is 0, i has to be out of range
}