C# XML Read with an application example

All tutorials created in C# to be posted in here.
1 post Page 1 of 1
Contributors
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

Hello and welcome to my how to read and phrase xml tutorial

Alright to start we are going to be needing to use namespace:

Using System.Xml;

Now create a new instance of the XmlDocumet
Code: Select all
XmlDocument xdoc = new XmlDocumnet();
Code: Select all
xdoc.load(url);
Now create a string and store the url of the Xml file/website
Code: Select all
string url = http://imdbapi.org/?title=The Walking Dead&type=xml&plot=full&episode=0&limit=1&yg=0&mt=none&lang=en-
US&offset=&aka=full&release=full&business=0&tech=0
Alright now We need to select the nodes that we need:
We will display the content from the node in a messagebox
Code: Select all
// Selects node title form node item witch is in the main node IMDBDocumentList
MessageBox.Show(xdoc.SelectSingleNode("IMDBDocumentList/item/title").InnerText;
This is the basic way to read XML i will post another tutorial sometime next week =D
feel free to post here if you need any help =D

Here is a practical application showing the use ='D
You do not have the required permissions to view the files attached to this post.
1 post Page 1 of 1
Return to “C-Sharp Tutorials”