mrjimoy_05 0 Newbie Poster

Hey all,

I have a problem to read a XML file using XmlReader. I have this code:

Dim xCount As Integer = 0

        Using xReader As XmlReader = XmlReader.Create("tekno.xml")

            Do While xReader.Read()
                With TreeView1
                    .Nodes(xCount).Nodes.Add("(link: " & xReader.Item("link") & ")")
                    .Nodes(xCount).Nodes.Add("Date: " & xReader.Item("pubDate"))
                    xCount = xCount + 1
                End With
        End Using

And the file .XML named ‘tekno.xml’:

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<title>Tablet Windows Tak Akan Dukung Flash</title>
<pubDate>Tue , 20 Sep 2011 11:43:29 +0000</pubDate><description>&lt;img src=&quot;; align=&quot;left&quot; hspace=&quot;7&quot; width=&quot;120&quot; height=&quot;90&quot;&gt;Pengguna perangkat tablet yang menggunakan Windows 8 bakal tidak akan bisa menggunakan menjalankan konten Flash untuk multimedia, video, dan game.</description>
<guid isPermaLink="false"></guid>

But it doesn't work. The code doesn't read the value of the element. How can I read the value of the element on the XML using XmlReader?

Please help.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.