Web Scanner Part-1


My favourite technology web site is updated throughout the day. I thought it would be nice to have a program that checked every 30 minutes for updates and told me what stories were there.

For the main page of my favourite site go to http://www.slashdot.org.

However slashdot also has a page which shows their main page stories as XML. To see this go to http://www.slashdot.org/slashdot.xml.

My idea now is to build an application that sits in the taskbar tray of a win2000 desktop and every 30 minutes go to the above site and modify the context menu to display links to the latest stories. I can then click the one I want to read and launch a browser.

The example code below shows how to read content from a web site which in my case is an xml page. I then parse the xml data and output just the story title and the URL.

Part two of this app hopefully will be a complete utility which will sit in the taskbar tray. Note applications like this could be looking at stock tickers or anything. Also if more web sites used xml then parsing the data becomes very easy.

Source Code

//Title : Webtest
//Author : John O'Donnell
//Email : wincepro@hotmail.com
//Date : 31/05/01
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Xml;
public class Class1
public Class1()
public static int Main(string[] args)
XmlDocument doc =
new XmlDocument();
WebRequest wr;
WebResponse ws;
StreamReader sr;
string line;
wr = WebRequestFactory.Create(http://www.slashdot.org/slashdot.xml);
ws = wr.GetResponse();
sr =
new StreamReader(ws.GetResponseStream(),Encoding.ASCII);
//Read entire document
doc.LoadXml(line); //Load the text into the xml document
catch(Exception e)
Console.WriteLine ("Exception: {0}", e.ToString());
//get the story and url nodes
XmlNodeList titles = doc.GetElementsByTagName("title");
XmlNodeList urls = doc.GetElementsByTagName("url");
for (int i=0; i < titles.Count; i++)
//note InnerXml returns just data, OuterXml returns tags as well
catch (Exception e)
Console.WriteLine (e.ToString());
return 0;