Creates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI. : XmlNode « XML « VB.Net






Creates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI.

 

Imports System
Imports System.Xml

public class Sample 

  public shared sub Main() 

       Dim doc as XmlDocument = new XmlDocument()
       doc.LoadXml("<book>" & _
                   "  <title>C#</title>" & _
                   "  <price>5.95</price>" & _
                   "</book>") 

       Dim newElem as XmlNode
       newElem = doc.CreateNode(XmlNodeType.Element, "pages", "")  
       newElem.InnerText = "2"

       Dim root as XmlElement = doc.DocumentElement
       root.AppendChild(newElem)

       Console.WriteLine(doc.OuterXml)
   end sub
end class

   
  








Related examples in the same category

1.Creates an XmlNode with the specified node type, Name, and NamespaceURI.
2.Creates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI.
3.Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.
4.Creates XmlNode based on the information in XmlReader
5.Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.
6.XmlNode.CloneNode creates a duplicate of the node.
7.Provides support for the for each style iteration over the nodes in the XmlNode.
8.XmlNode.GetPrefixOfNamespace
9.XmlNode.InsertAfter inserts the specified node immediately after the specified reference node.
10.XmlNode.InsertBefore inserts the specified node immediately before the specified reference node.
11.XmlNode.Item gets the first child element with the specified Name.
12.XmlNode.LastChild gets the last child of the node.
13.XmlNode.NextSibling gets the node immediately following this node.
14.XmlNode.SelectNodes Method (String, XmlNamespaceManager)
15.Selects the first XmlNode that matches the XPath expression.
16.XmlNode.SelectSingleNode Method (String, XmlNamespaceManager)
17.XmlNode.WriteContentTo saves all the child nodes of the node to the specified XmlWriter.
18.XmlNode.WriteTo saves the current node to the specified XmlWriter.
19.Create XmlTextReader class with the specified string, XmlNodeType, and XmlParserContext.