//
you're reading...
IT-Center, VB.NET

VB.NET Read XML Fundamental

XML File:

'<?xml version = "1.0"?>
'<books xmlns = "x-schema:book.xdr">
'   <book>
'      <title>C# How to Program</title>
'   </book>

'   <book>
'      <title>Java How to Program, 4/e</title>
'   </book>

'   <book>
'      <title>Visual Basic .NET How to Program</title>
'   </book>

'   <book>
'      <title>Advanced Java Platform How to Program</title>
'   </book>

'   <book>
'      <title>Python How to Program</title>
'   </book>
'</books>

VB.NET Script :

Imports System
Imports System.Drawing
Imports System.Data
Imports System.IO
Imports System.Collections
Imports System.Windows.Forms
Imports System.Xml

Public Class MainClass
    Shared Sub Main()
        Dim filename As String = "book.xml"

        Dim reader As New XmlTextReader(filename)
        reader.MoveToContent()

        Dim addressData As Collection, elementName As String

        Do While reader.Read

            Select Case reader.NodeType

            Case XmlNodeType.Element
                 Console.WriteLine("XmlNodeType.Element " & reader.Name )

            Case XmlNodeType.Text
                 Console.WriteLine("XmlNodeType.Text " & reader.Value )
            Case XmlNodeType.EndElement
                 Console.WriteLine("XmlNodeType.EndElement " & reader.Name )
            End Select

        Loop
    End Sub
End Class

See Also :http://www.java2s.com/Code/VB/XML/XmlTextReaderXmlNodeTypeElementTextandEndElement.htm
http://www.dotnetperls.com/xmlreader-vbnet

About berbagisolusi

Berbagi merupakan sebuah bentuk simbol keikhlasan untuk membantu dan menolong, sedangkan solusi adalah cara menyelesaikan masalah. Setiap manusia pasti mengalami masalah, tetapi kita tidak perlu mengalami masalah yang sama jika orang lain pernah mengalami dan kita tahu hal tersebut.

Discussion

One thought on “VB.NET Read XML Fundamental

  1. Try this…XML reader

    warner

    Posted by warner | September 30, 2014, 2:58 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

February 2012
M T W T F S S
« Jan   Mar »
 12345
6789101112
13141516171819
20212223242526
272829  

Archives

Web Statistic

Blog Stats

  • 149,551 hits
%d bloggers like this: