Add the new node to the bottom of the XML tree : XElement « XML LINQ « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » XML LINQ » XElementScreenshots 
Add the new node to the bottom of the XML tree
  
Imports System
Imports System.Xml.Linq

    Public Class MainClass
        Public Shared Sub Main()
            Dim employees As XElement = XElement.Load("Employees.xml")
            Dim newEmployee = <Employee id=<%= %>>
                                  <Name>First</Name>
                                  <Title>Coder</Title>
                                  <HireDate>07/15/2006</HireDate>
                                  <HourlyRate>9.95</HourlyRate>
                              </Employee>

            employees.Add(newEmployee)

            For Each ele In employees.<Employee>
                ele.Add(<TerminationDate></TerminationDate>)
                ele.Add(New XAttribute("Status"""))
            Next
            Console.WriteLine(employees.ToString())
        End Sub
    End Class

   
    
  
Related examples in the same category
1.Build an XElement from string
2.Create a single XML element
3.After elements
4.Adding XElement to XElement
5.Before elements
6.Create an in-memory XML document
7.First name element has attributes
8.First name tag has child elements
9.FirstLast Or Default Example
10.First Last Example
11.FirstName tag's parent has child elements
12.Get first descendant
13.Load the Employees.xml and store the contents into an XElement object.
14.Remove content from XElement
15.Remove from XElement
16.Replace content from XElement
17.Update attribute for XElement
18.Update XElement
19.Using Xml Linq to output Html
20.using XElement.Parse to load Xml from String
21.Xml Literal with string variable
22.Xml literal with function return
23.Enumerate over the array to build an XElement
24.Add 5 new green Fords to the incoming document
25.Create a query to convert the xml data into fields delimited by quotes and commas.
26.Convert comma separated value to Xml
27.Get child elements by name directly
28.Get value of each color using indexer
29.Is FirstName tag empty?
30.Is idperson tag empty?
31.Remove the 4th Employee element.
32.Using Ling query to create Xml output
33.The Root property returns the top-level XElement
34.Set new value to Xml document
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.