tunafish Posted May 6, 2009 Share Posted May 6, 2009 Im working on a simple application that will grab RSS feeds from a website and display them when the program is loaded. But i cant find any windows mobile relevent code and have no idea where to go. My RSS has the following content that needs to be extracted. Each content is labeled at <item> and there is about 6 of them in the RSS feed. Of course ya have all the normal RSS stuff that descripes what the RSS feed is. <item> <title>Testing</title> <description>Description here</description> <link>http://192.168.2.1/testing.htm</link> <guid isPermaLink="false">http://192.168.2.1/testing.htm</guid> <pubDate>Mon, 01 Jan 2000 00:00:00 GMT</pubDate> <category>6</category> </item> How can this be done in VB.NET for Windows Mobile. As i dont really know C++ Link to comment Share on other sites More sharing options...
0 tunafish Posted May 9, 2009 Author Share Posted May 9, 2009 Anyone know how this can be done? As im still at a loss and need a bit of guiudence Link to comment Share on other sites More sharing options...
0 Antaris Veteran Posted May 13, 2009 Veteran Share Posted May 13, 2009 Hey, Windows Mobile supports the .NET Compact Framework, which supports a subset of the full .NET Framework's Xml functionality. A good place to start would be here. As long as you get the xml, you can pass it to something like an XmlTextReader, or an XmlDocument and you should be fine. Make sure you check on that page what exactly the Compact Framework can and can't do in regards to Xml. MSDN is your friend :) Link to comment Share on other sites More sharing options...
0 tunafish Posted May 21, 2009 Author Share Posted May 21, 2009 Yer i did read that but i cant find any sample code for windows mobile that shows me how to grab and read XML from a web url Link to comment Share on other sites More sharing options...
0 Antaris Veteran Posted May 21, 2009 Veteran Share Posted May 21, 2009 Well, the mobile code is essentially the same as the desktop code: Public Function GetXmlContent(ByVal uri As String) As XmlTextReader If (String.IsNullOrEmpty(uri)) Then Throw New ArgumentNullException(uri) End If Dim reader As XmlTextReader = New XmlTextReader(uri) Return reader End Function And you should be able to call it using: Dim reader As XmlTextReader = GetXmlContent("http://feeds.neowin.net/neowin-forum") Then just process your xml. If you'd prefere to use something like an XmlDocument, you'd need to read the entire xml stream before you create the document: Public Function GetXmlContent(ByVal uri As String) As XmlDocument If (String.IsNullOrEmpty(uri)) Then Throw New ArgumentNullException(uri) End If Dim request As HttpWebRequest = WebRequest.Create(uri) Dim response As HttpWebResponse = request.GetResponse() Dim reader As StreamReader = New StreamReader(response.GetResponseStream()) Dim document As XmlDocument = New XmlDocument() document.LoadXml(reader.ReadToEnd()) reader.Close() Return document End Function Don't forget though, an XmlDocument keeps the xml in memory, but you get the perks of being able to manipulate and search through the Xml DOM. I'd recommend using an XmlTextReader in a mobile environment for the performance benenifts, but the caveat of that is it is a forward-only stream reader. Hope that helps getting you started, but you may want to validate some of that code, its all from the head :p Link to comment Share on other sites More sharing options...
Question
tunafish
Im working on a simple application that will grab RSS feeds from a website and display them when the program is loaded.
But i cant find any windows mobile relevent code and have no idea where to go.
My RSS has the following content that needs to be extracted. Each content is labeled at <item> and there is about 6 of them in the RSS feed.
Of course ya have all the normal RSS stuff that descripes what the RSS feed is.
How can this be done in VB.NET for Windows Mobile. As i dont really know C++
Link to comment
Share on other sites
4 answers to this question
Recommended Posts