knee_boarder
Member
I'm trying to get the values from xml produced by an rss feed which I feed into an XmlDocument.
example xml
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I have no problem in reading out the first category using this code
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
but I can't figure out how to iterate through all the <category>'s. There can be any number of category's added so it's not a fixed quantity.
	
		
			
		
		
	
				
			example xml
			
				VB.NET:
			
		
		
		<item>
<title>
Tennis courts are undergoing improvements this autumn.
</title>
<link>
link
</link>
<comments>
comments
</comments>
<pubDate>Thu, 26 Sep 2013 13:08:12 +0000</pubDate>
<dc:creator>Mair</dc:creator>
<category>
<![CDATA[ Homepage Thumbnail ]]>
</category>
<category>
<![CDATA[ Homepage Top Stories ]]>
</category>
<category>
<![CDATA[ Leisure ]]>
</category>
<category>
<![CDATA[ Thumbnail news ]]>
</category>
<category>
<![CDATA[ Top Stories ]]>
</category>
<category>
<![CDATA[ Football ]]>
</category>
<category>
<![CDATA[ ilfracombe ]]>
</category>
<description>
<![CDATA[
Tennis courts are undergoing improvements this autumn.
]]>
</description>
</item>
	I have no problem in reading out the first category using this code
			
				VB.NET:
			
		
		
		Dim rssXmlDoc As New XmlDocument
        ' Load the RSS file from the RSS URL
        rssXmlDoc.Load(strUrl)
        ' Parse the Items in the RSS file
        Dim rssNodes As XmlNodeList = rssXmlDoc.SelectNodes("rss/channel/item")
        Dim title As String
        Dim link As String
        Dim category As String
        Dim rssNode As XmlNode
        Dim rssSubNode As XmlNode
        'Iterate through the items in the RSS file
        For Each rssNode In rssNodes
            rssSubNode = rssNode.SelectSingleNode("title")
            title = rssSubNode.InnerText
            rssSubNode = rssNode.SelectSingleNode("link")
            link = rssSubNode.InnerText
            rssSubNode = rssNode.SelectSingleNode("category")
            category = rssSubNode.InnerText
            Response.Write("<a href=""" + link + """>" + title + "</a>" + "<br /><br />")
            Response.Write(category + "<br /><br />")
	but I can't figure out how to iterate through all the <category>'s. There can be any number of category's added so it's not a fixed quantity.