There has to be an easy answer for this, I hope!
I basically need the grandchildren of the below xml tree to show up in a vb.net gridview. I have the data getting pulled but all values are getting put into a single cell.
Here is the xml tree.
<?xml version="1.0" encoding="utf-8" ?>
<Feedmain>
<Feed>
<Name>ScottGu Blog</Name>
<Url>http://weblogs.asp.net/scottgu/rss.aspx</Url>
<testgoober>
<goober>goober 1 - scott blog</goober>
<goober>goober 2 - scott blog</goober>
<goober>goober 3 - scott blog</goober>
</testgoober>
</Feed>
<Feed>
<Name>Weblogs.ASP.Net Main Feed</Name>
<Url>http://weblogs.asp.net/MainFeed.aspx</Url>
<testgoober>
<goober>goober 1 - ASP.Net blog</goober>
<goober>goober 2 - ASP.Net blog</goober>
<goober>goober 3 - ASP.Net blog</goober>
</testgoober>
</Feed>
<Feed>
<Name>Bozo Blog</Name>
<Url>http://somesite.com/bozo.rss</Url>
<testgoober>
<goober>goober 1 - Bozo blog</goober>
<goober>goober 2 - Bozo blog</goober>
<goober>goober 3 - Bozo blog</goober>
</testgoober>
</Feed>
</Feedmain>
Here is the basic code I am using. I am breaking all the data into seperate gridviews but the grandchildren just don't want to play nice. What am I missing?
BTW, sam is the one giving problems.
Dim feedXML As XDocument = XDocument.Load("c:\Feeds.xml")
Dim bubba = From q In feedXML.Descendants("Feed") _
Select New With { _
.name = q.Element("Name").Value() _
}
DataGridView3.DataSource = bubba.ToList()
Dim yvette = From q2 In feedXML.Descendants("Feed") _
Select New With _
{ _
.url = q2.Element("Url").Value() _
}
DataGridView2.DataSource = yvette.ToList()
'This is where we have a problem. Right now we are getting everything as an array.
' this is new, we haven't had this before. Now how to do we break it up.
'below is my control code. it pulls all the values but it putting them all into a
'single cell.
'Dim sam = From q3 In feedXML.Descendants("Feed") _
' Select New With _
' { _
' .url3 = q3.Elements("testgoober").Value() _
' }
'DataGridView4.DataSource = sam.ToList()
Dim sam = From q3 In feedXML.Descendants("Feed") _
Select New With _
{ _
.url3 = q3.Elements("testgoober").Value() _
}
DataGridView4.DataSource = sam.ToList()
When I run the code my datagrid returns the following in one cell for each set of grandchildren:
goober 1 - scott bloggoober 2 - scott bloggoober 3 - scott blog
and it need it broken up into rows like:
goober 1 - scott blog
goober 2 - scott blog
goober 3 - scott blog
Thanks for helping a newbie!
Dewayne