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")
TreeView1.Nodes.Clear()
Do While xReader.Read()
With TreeView1
.Nodes.Add(xReader.Item("title"))
.Nodes(xCount).Nodes.Add("(link: " & xReader.Item("link") & ")")
.Nodes(xCount).Nodes.Add("Date: " & xReader.Item("pubDate"))
.Nodes(xCount).Nodes.Add(xReader.Item("description"))
xCount = xCount + 1
End With
Loop
TreeView1.ExpandAll()
End Using
And the file .XML named ‘tekno.xml’:
<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
<item>
<title>Tablet Windows Tak Akan Dukung Flash</title>
<link>http://tekno.kompas.com/read/2011/09/20/11432939/Tablet.Windows.Tak.Akan.Dukung.Flash</link>
<pubDate>Tue , 20 Sep 2011 11:43:29 +0000</pubDate><description><img src="http://stat.k.kidsklik.com/data/photo/2011/09/16/1430299t.jpg" align="left" hspace="7" width="120" height="90">Pengguna perangkat tablet yang menggunakan Windows 8 bakal tidak akan bisa menggunakan menjalankan konten Flash untuk multimedia, video, dan game.</description>
<guid isPermaLink="false">http://tekno.kompas.com/read/2011/09/20/11432939/Tablet.Windows.Tak.Akan.Dukung.Flash</guid>
</item>
</channel>
</rss>
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.
Thanks