Create a query to convert the xml data into fields delimited by quotes and commas. : 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 
Create a query to convert the xml data into fields delimited by quotes and commas.
  


Imports System
Imports System.Xml.Linq
Imports Microsoft.VisualBasic.FileIO
Imports System.Text
Imports System.IO

    Public Class MainClass

        Public Shared Sub Main(ByVal args As String())
            Dim employees As XElement = XElement.Load("xmlFile.xml")
            Dim delimitedData As New StringBuilder

            Dim xmlData = _
                From emp In employees.<Employee> _
                    Select _
                    String.Format("""{0}"",""{1}"",""{2}"",""{3}"",""{4}""", _
                        emp.@id, emp.<Name>.Value, _
                        emp.<Title>.Value, emp.<HireDate>.Value, _
                        emp.<HourlyRate>.Value)

        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.Add the new node to the bottom of the XML tree
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.