Parsing WML into HTMLBy Thomas Winningham
I picked up a Pocket Mail (http://www.pocketmail.com) portable email device, and have since been working on various projects to get things done while I'm out of town. I've become quite a Slashdot addict while I'm actually in the office, but have missed the stories while traveling. They have a very good Palm interface that works great, but at the time of writing this code, it was not getting updated often. I did find, however, that their WML interface, which includes the stories in text format, was working fine.
Slashdot also has a nice XML version (http://slashdot.org/slashdot.xml) that is just as easily parsed using the Microsoft XMLDOM in ASP, but only contains links to the stories, and no actual content besides the title of news articles. Here is a way to parse the XML code to display a list of stories and other information:
For more information on XML be sure to visit the XML Article Index!
This produces an output like this with links to the articles:
2000-05-18 12:32:10:articles:Boo No More by emmett
2000-05-18 12:05:53:articles:Main Linux Distros Port To IBM's S/390 by HeUnique
2000-05-18 10:01:23:bsd:OpenBSD, Reductionist Design by nik
2000-05-18 05:39:21:articles:Alpha Release Of Red Hat's Itanium Distro by timothy
2000-05-18 03:00:12:science:Online Book About Nano/AI by Hemos
2000-05-18 02:21:55:articles:Government Gives Microsoft Offer Thumbs Down by Hemos
2000-05-17 23:59:47:articles:H.R. 3113: Spam Bounty Hunters Wanted by timothy
2000-05-17 21:06:02:articles:Court Rules For Connectix, Against Sony by Hemos
2000-05-17 19:52:31:articles:E3: Linux Still Waiting In The Wings by timothy
2000-05-17 16:40:13:articles:Dialectizer Shut Down by emmett
There's a couple of important things to note here. First off, Slashdot is a very busy site, and they recommend
that you only use the
slashdot.xml once every 30 minutes. Another issue is that the Microsoft
XMLDOM is somewhat broken when it comes to use in ASP.
According to this article at http://support.microsoft.com/support/kb/articles/Q237/9/06.ASP, it is probably best to select another means of using outside HTTP data for use in your ASP programs. Currently I've been using ASPTear from Softwing. Version 1.0 is a free download, and version 1.2 is a commercial product. There are many good articles on ASPTear as well, such as: Grabbing Information from Other Web Servers.
Now that we've looked at how to parse the XML Slashdot feed, in Part 2 we'll look at how to obtain and parse the WML Slashdot feed! (For more information on WML and related technologies, be sure to visit the WML and HDML Article Index!)