Get current value and depth during the XML document reading process : Xml Node « XML « C# / CSharp Tutorial






using System;
using System.Xml;

class MainClass
{
    static void Main(string[] args)
    {

        XmlTextReader reader = new XmlTextReader(@"C:\books.xml");

        while (reader.Read())
        {
            if (reader.HasValue)
            {                                       
                Console.WriteLine("Name: "+reader.Name);
                Console.WriteLine("Level of the node: " +reader.Depth.ToString());
                Console.WriteLine("Value: "+reader.Value);
            }
        }
    }
}








30.11.Xml Node
30.11.1.Read an XML file and displays each of the nodes.
30.11.2.Find nodes by name
30.11.3.Select Nodes By Namespace from XmlDocument
30.11.4.XmlNode: InsertAfter FirstChild
30.11.5.Xml Node List
30.11.6.Select nodes from XmlDocument
30.11.7.Recursively display XmlNode
30.11.8.Replace Children
30.11.9.Root Node
30.11.10.Insert after
30.11.11.Append element
30.11.12.Get current value and depth during the XML document reading process
30.11.13.Read XML document by node type
30.11.14.Check for Xml node name
30.11.15.Extract elements for types
30.11.16.Get elements
30.11.17.Select By Specific Author Node
30.11.18.Write types to the console
30.11.19.Select node by node text