0

Hi again, I am trying to read an XML file in this format;

<?xml version="1.0" encoding="utf-8"?>
<words>
<word id="Apple" def="A fruit" />
<word id="Dinosaurs" def="Now Extinct Animal" />
<word id="Giant Panda" def="An Endangered Animal" />
<word id="Asia" def="The Largest Continent" />
.....
</words>

I have more than 3000 lines like this. And I want to read the XML file in to two listboxes, Listbox1 will contain the 'id' word and Listbox2 will contain the 'def' word(s) and I have absolutely no idea how to do this, So how am i to do this please?

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by softwareskill
1

this might give you an idea

Imports System.Xml.Linq


		Dim xmlFile As XDocument = XDocument.Load("C:\Users\GeekByChoiCe\Desktop\test.xml")
		Dim _content As IEnumerable(Of XElement) = xmlFile.Root.Elements("word")
		ListBox1.DataSource= (From g In _content Select g.@id).ToList
		ListBox2.DataSource= (From g In _content Select g.@def).ToList

Edited by GeekByChoiCe: n/a

Votes + Comments
:)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.