Parsing Xml or Rss Feeds through Data Binding

Parsing Xml or Rss Without Blend

Have you ever thought of an application that will get required information from a particular website and display it on the phone. Now after this tutorial it will not be difficult to do so. Lets just first see what's RSS. It stands for "Really Simple Syndication". A way to keep update some application or content with latest information. When we subscribe with RSS feeds latest information is downloaded automatically. There is another code XML that is used in this process. Xml data is used to arrange some of the information and put the data in it. That will be discussed below.
First of all the main grid contains the stack panel that is displaying the news feed and BBC news icon.
After that a grid is made as you can see in the picture below. That contain a stack panel in that stack panel there are three text boxes according to which data is binded. Title pubData and description are three tags that are or Xml. If we see the code of the website or URL that is returning the xml code. That have these three tags in it.The data in that is placed into this. You can see a text wrapping property too that you should Google and see that i  will organize the text. Here the code in mainpage.xaml is completed as we have created three text boxes.


Now lets move to the main page.cs. Here the real code is written. First we have created an object of web-client. Below that it's creating new classes. Where the button is as a parameter is given.Below that you will find a code that will go to the website as we are here using the BBC RSS feeds it will fetch xml code and in the button bellow the the code is parsed. You will find a condition
if(Microsoft.phone.net.networkinformation.Device networkinformation.Isnetworkavailable)
the conditon will check for the internet connection and then if available it will download the required information.


    Here is a class is created by going to the solution explorer. right click it and add a new class.
This will provide the structure that every section will have as you have seen above in xaml code we have created the three textboxes.And title will show the info on it. Other's respectively will do the same.


Umm. here is something important in order to make the linq code workable we have to add this library. The line written in the end. using system.xml.linq.



Here is our application is in working condition.



Comments

Popular posts from this blog

Input.Getaxis, OnMouseDown, GetComponent< > - Unity Scripts

How to move an object in Unity 3D