XPathNavigator.AppendChild Creates a child node using XML data string : XPathNavigator « XML « C# / C Sharp

XPathNavigator.AppendChild Creates a child node using XML data string

using System;
using System.Linq;
using System.Xml;
using System.Xml.XPath;

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

public class MainClass
    public static void Main()
        XmlDocument document = new XmlDocument();
        XPathNavigator navigator = document.CreateNavigator();

        navigator.MoveToChild("bookstore", "http://www.domain.com/books");
        navigator.MoveToChild("book", "http://www.domain.com/books");



<?xml version="1.0" encoding="utf-8" ?>
<bookstore xmlns="http://www.domain.com/books">
    <book genre="Programming" publicationdate="2010-03-22" ISBN="1-111111-11-0">
    <book genre="data" publicationdate="2010-11-17" ISBN="0-201-11111-2">
    <book genre="web" publicationdate="2010-02-15" ISBN="1-111111-57-6">


Related examples in the same category

1.XPathNavigator.AppendChildElement Creates a child element node at the end of the list
2.XPathNavigator.CanEdit indicates whether the XPathNavigator can edit the underlying XML data.
3.XPathNavigator.Clone creates a XPathNavigator positioned at the same node.
4.XPathNavigator.CreateAttribute creates attribute node using namespace prefix, local name and namespace URI
5.XPathNavigator.CreateAttributes returns an XmlWriter to create new attributes
6.XPathNavigator.DeleteRange deletes a range of sibling nodes
7.XPathNavigator.DeleteSelf deletes the current node and its child nodes.
8.XPathNavigator.Evaluate evaluates XPath expression and returns typed result
9.XPathNavigator.Evaluate Uses context to evaluate the XPathExpression
10.XPathNavigator.InnerXml Gets or sets the markup representing the child nodes
11.XPathNavigator.InsertAfter creates a sibling node after the selected node
12.XPathNavigator.InsertAfter creates node after the selected node
13.XPathNavigator.InsertBefore creates a new sibling node before the selected node
15.XPathNavigator.Matches tells whether the current node matches the specified XPathExpression.
16.XPathNavigator.MoveToFirstAttribute moves XPathNavigator to the first attribute of the current node.
17.XPathNavigator.MoveToFollowing moves XPathNavigator to the element with the local name and namespace URI
18.XPathNavigator.NavigatorComparer Gets an IEqualityComparer used for equality comparison of XPathNavigator objects.
19.XPathNavigator.OuterXml gets or sets the markup of the current node and its child nodes.
20.XPathNavigator.PrependChild creates child node at the beginning
22.XPathNavigator.ReadSubtree reads the current node and its child nodes.
23.XPathNavigator.ReplaceRange replaces a range of sibling nodes
24.XPathNavigator.ReplaceSelf replaces the current node
25.XPathNavigator.Select Selects a node set, using the specified XPath expression.
26.XPathNavigator.SelectAncestors selects all the ancestor nodes of the current
27.XPathNavigator.SelectSingleNode selects a single node in XPathNavigator using XPath query
28.XPathNavigator.SetTypedValue Sets the typed value of the current node.
29.XPathNavigator.SetValue Sets the value of the current node.
30.XPathNavigator.ValueAsBoolean Gets the current node's value as a Boolean.
31.XPathNavigator.ValueType Gets the .NET Framework Type of the current node.
32.XPathNavigator.WriteSubtree outputs node and its child nodes to the XmlWriter