public abstract class XmlNodeList : IEnumerable
|
Count | Read-only Gets the number of nodes in the XmlNodeList. |
ItemOf | Read-only Retrieves a node at the given index. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetEnumerator | Provides a simple "foreach" style iteration over the collection of nodes in the XmlNodeList. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Item | Retrieves a node at the given index. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
protected XmlNodeList(); |
public abstract int Count {get;}
|
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("2books.xml"); //Get and display all the book titles. XmlElement root = doc.DocumentElement; XmlNodeList elemList = root.GetElementsByTagName("title"); for (int i=0; i < elemList.Count; i++) { Console.WriteLine(elemList[i].InnerXml); } } }The example uses the file, 2books.xml, as input.
<!--sample XML fragment--> <bookstore> <book genre='novel' ISBN='10-861003-324'> <title>The Handmaid's Tale</title> <price>19.95</price> </book> <book genre='novel' ISBN='1-861001-57-5'> <title>Pride And Prejudice</title> <price>24.95</price> </book> </bookstore>
No member name
public virtual XmlNode this[int i] {get;}
|
i
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("2books.xml"); //Get and display all the book titles. XmlElement root = doc.DocumentElement; XmlNodeList elemList = root.GetElementsByTagName("title"); for (int i=0; i < elemList.Count; i++) { Console.WriteLine(elemList[i].InnerXml); } } }The example uses the file, 2books.xml, as input.
<!--sample XML fragment--> <bookstore> <book genre='novel' ISBN='10-861003-324'> <title>The Handmaid's Tale</title> <price>19.95</price> </book> <book genre='novel' ISBN='1-861001-57-5'> <title>Pride And Prejudice</title> <price>24.95</price> </book> </bookstore>
~XmlNodeList(); |
public abstract IEnumerator GetEnumerator(); |
using System; using System.IO; using System.Xml; using System.Collections; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("2books.xml"); //Get and display all the book titles. XmlElement root = doc.DocumentElement; XmlNodeList elemList = root.GetElementsByTagName("title"); IEnumerator ienum = elemList.GetEnumerator(); while (ienum.MoveNext()) { XmlNode title = (XmlNode) ienum.Current; Console.WriteLine(title.InnerText); } } }The example uses the file, 2books.xml, as input.
<!--sample XML fragment--> <bookstore> <book genre='novel' ISBN='10-861003-324'> <title>The Handmaid's Tale</title> <price>19.95</price> </book> <book genre='novel' ISBN='1-861001-57-5'> <title>Pride And Prejudice</title> <price>24.95</price> </book> </bookstore>
public virtual int GetHashCode(); |
public Type GetType(); |
index
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<items>" + " <item>First item</item>" + " <item>Second item</item>" + "</items>"); //Get and display the last item node. XmlElement root = doc.DocumentElement; XmlNodeList nodeList = root.GetElementsByTagName("item"); Console.WriteLine(nodeList.Item(1).InnerXml); } }
protected object MemberwiseClone(); |
public virtual string ToString(); |