I really have not worked much with XML and I would appreciate some help.
I am trying to read an RSS feed from WeatherBug
I found some sample code here:
http://geekswithblogs.net/thibbard/archive/2006/01/13/65764.aspx
Where they are using System.Data.DataSet to read the XML feed.
(They are using VBasic I am using VC#)
Here is a sample of the XML I am trying to read:
In the code example they get the wind speed as follows:
_wind = DS.Tables(“wind-speed”).Rows(0).Item(“wind-speed_Text”)
How do I know what to specify for each of the index values? I think I understand how they determined to specify wind-speed but how did they determine how to specify wind-speed_Text?
I can see the values in my debugger using:
m_ds.Tables[“wind-speed”].Rows[0].ItemArray
I can see 3 values. “MPH”, “3” and 0.
MPH would be the units. “3” would be the speed. Not sure what 0 is.
And how would I access the value at aws:WebURL?
And I am only seeing 8 tables.But there are more values than that. By poking around with the debugger, I found those URLs in the Weather table along with the values for wind-direction and gust-direction.
I thought I had the whole table thing nailed down but there seems to be no rhyme nor reason to it.
Can anyone put me on the right path? Basically I just need to know how to figure out how to find stuff in the DataTables based on what I am seeing in the XML.
Thanks
Quick and easy:
You can also use LINQ: