Replace content from XElement : 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 
Replace content from XElement
  

Imports System
Imports System.Reflection
Imports System.Xml

Module Module1

    Sub Main()

        Dim xml As XElement = XElement.Load("People.xml")

        xml.Element("person").ReplaceNodes(New XElement("id"5), _
                                             New XElement("firstname""A"), _
                                             New XElement("lastname""B"), _
                                             New XElement("role"1))
        Console.WriteLine(xml)

    End Sub
End Module

   
    
  
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.Update attribute for XElement
17.Update XElement
18.Using Xml Linq to output Html
19.using XElement.Parse to load Xml from String
20.Xml Literal with string variable
21.Xml literal with function return
22.Enumerate over the array to build an XElement
23.Add 5 new green Fords to the incoming document
24.Add the new node to the bottom of the XML tree
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.