Gets the first child of the node. : XML Node « XML « C# / C Sharp

C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
5.Data Types
7.Date Time
8.Design Patterns
9.Development Class
11.File Stream
13.GUI Windows Form
14.Internationalization I18N
15.Language Basics
20.Regular Expressions
22.Services Event
24.Web Services
26.Windows Presentation Foundation
C# / C Sharp » XML » XML NodeScreenshots 
Gets the first child of the node.

using System;
using System.IO;
using System.Xml;

public class Sample {

  public static void Main() {

    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book ISBN='1-111111-57-5'>" +
                "<title>C#</title>" +
                "<price>19.95</price>" +

    XmlNode root = doc.FirstChild;

    Console.WriteLine("Display the title element...");

Related examples in the same category
1.Create an element type XmlNode like text value
2.Get the Xml Text node value
3.Set the value to the Element
4.Alphabetical sorting of the XmlNodes
5.Convert an XmlNode to an object
6.Adds the specified node to the end of the list of child nodes, of this node.
7.Gets an XmlAttributeCollection containing the attributes of this node.
8.Gets all the child nodes of the node.
9.Creates a duplicate of this node.
10.Creates an XPathNavigator for navigating this object.
11.For each style iteration over the nodes in the XmlNode.
12.Looks up the closest xmlns declaration for the given namespace URI
13.Gets or sets the concatenated values of the node and all its child nodes.Gets or sets the concatenated values of the node and all its child nodes.
14.Inserts the specified node immediately after the specified reference node.
15.Inserts the specified node immediately before the specified reference node.
16.Gets the first child element with the specified Name.
17.Gets the last child of the node.
18.Gets the node immediately following this node.
19.Gets the markup representing this node and all its child nodes.
20.Adds node to the beginning of the list of child nodes
21.Gets the node immediately preceding this node.
22.Removes all the child nodes and/or attributes of the current node.
23.Removes specified child node.
24.Replaces the child node oldChild with newChild node.
25.Selects a list of nodes matching the XPath expression.
26.Select and display the value of all the ISBN attributes
27.Selects the first XmlNode that matches the XPath expression.
28.When overridden in a derived class, saves all the child nodes of the node to the specified XmlWriter.
29.Save the current node to the specified XmlWriter.  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.