System.Xml.XmlNamedNodeMap.Item C# (CSharp) Method

Item() public method

public Item ( int index ) : XmlNode
index int
return XmlNode
        public virtual XmlNode Item(int index) {
            if (index < 0 || index >= Nodes.Count)
                return null;
            try {
                return(XmlNode) Nodes[index];
            } catch ( ArgumentOutOfRangeException ) {
                throw new IndexOutOfRangeException(Res.GetString(Res.Xdom_IndexOutOfRange));
            }
        }

Usage Example

示例#1
0
 /// <summary>Read Element named magic. </summary>
 private void  ReadMagic(System.Xml.XmlElement element, MimeType mimeType)
 {
     // element.getValue();
     System.String offset             = null;
     System.String content            = null;
     System.String type               = null;
     System.Xml.XmlNamedNodeMap attrs = (System.Xml.XmlAttributeCollection)element.Attributes;
     for (int i = 0; i < attrs.Count; i++)
     {
         System.Xml.XmlAttribute attr = (System.Xml.XmlAttribute)attrs.Item(i);
         if (attr.Name.Equals("offset"))
         {
             offset = attr.Value;
         }
         else if (attr.Name.Equals("type"))
         {
             type = attr.Value;
             if (String.Compare(type, "byte", true) == 0)
             {
                 type = "System.Byte";
             }
         }
         else if (attr.Name.Equals("value"))
         {
             content = attr.Value;
         }
     }
     if ((offset != null) && (content != null))
     {
         mimeType.AddMagic(System.Int32.Parse(offset), type, content);
     }
 }
All Usage Examples Of System.Xml.XmlNamedNodeMap::Item