Xml Node List : Xml Node « XML « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » XML » Xml Node 
30.11.5.Xml Node List
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Xml;
using System.Net;

public class MainClass
{
    public static void Main(){
        
        string xml = new WebClient().DownloadString("http://blogs.apress.com/wp-rss2.php");

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(xml);

        ProcessNodes(doc.ChildNodes);
    }

    private static void ProcessNodes(XmlNodeList nodes)
    {
        foreach (XmlNode node in nodes)
        {
            Console.WriteLine(string.Format("{0} - {1} - {2}",node.GetType().Name, node.Name,node.Value));

            if (node.HasChildNodes)
                ProcessNodes(node.ChildNodes);
        }
    }
}
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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.