Get elements : Xml Node « XML « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

   class Program
   {
      static void Main(string[] args)
      {
         XmlDocument documentation = new XmlDocument();
         documentation.Load("a.xml");

         XmlNodeList memberNodes = documentation.SelectNodes("//member");

         List<XmlNode> typeNodes = new List<XmlNode>();
         foreach (XmlNode node in memberNodes)
         {
            if (node.Attributes["name"].Value.StartsWith("T"))
            {
               typeNodes.Add(node);
            }
         }
         Console.WriteLine("Types:");
         foreach (XmlNode node in typeNodes)
         {
            Console.WriteLine("- {0}", node.Attributes["name"].Value.Substring(2));
         }
      }
   }








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