Content Management and Distribution Using XML
by Marc Robards
Introduction
With more and more devices hitting the market that are
Internet-Enabled (such as wireless phones, handheld computers,
even refrigerators), more and more people are going to be surfing the
web on things that hardly (if at all) resemble the desktop computer and
web browser that started all the commotion in the first place. This is a
good thing. It means greater connectivity and can lead to wonderful things
like voice recognition and wireless broadband. But right now, in the real world,
with all those different devices (not to mention different formats and supposed "standards"
popping up all the time), developing numerous outputs for the same underlying content
can easily become overwhelming.
That's one of the reasons we've started a project on the Wireless Developer Network that will attempt to solve at least part of the problem of outputting content
to a number of different formats. It's called XMLCast, and it basically takes content formatted
in a tidy XML structure, parses it, and outputs the content in a number of different formats, such as HTML,
simple HTML (for less robust browsers like those found on handheld devices), RSS, and of course, WML. We'll kick XMLCast off with this article
and will follow up over the next several weeks by continually adding to the application. When we're done, you should have a good idea as to how
you too can use XML to standardize data sharing and distribution between multiple applications, devices, or customers.
We've developed XMLCast using Microsoft's Active Server Pages. We chose ASP because of Microsoft's feature-rich XML parser, the
simplistic nature of VBScript, and the fact that there are a whole bunch of web sites running on IIS out there.
And on the plus side, it's not necessary to set the mime type (though you may want to do it anyway, in case you're serving regular .wml files)
because we do it in the ASP script itself.
Click here to download the ASP Source File.
Quite essential to understanding XMLCast is a working understanding of what XML is and how it works. For everything you would ever need
to know about XML, give xml.com a visit.
Other than that, a good working knowledge of ASP, HTML, and WML will help you understand what we're doing in
this application. (For ASP info, go to Microsoft's MSDN.
For HTML info, W3C is a good place to start, and for WAP, look no farther
than our very own WAP Tutorials.)
For simplicity, we're going to be using a news page as our content, but this application can be altered to allow
for any sort of content, as long as you know the XML structure. Our news is made up of four basic elements:
- Heading
- Link
- Summary
- Paragraphs
The Heading section refers to the title of the news article, the Link is a unique identifier for each article
so the full article can be retrieved from a "Summary" page. The Summary is a short description of the article
that is listed on the Summary page. The 's are enclosed within a tag, mostly because for
wml, XMLCast sends out each paragraph as a separate card. But we're getting ahead of ourselves, so let's have
a look at the XML DTD and an example news xml document. Here's the news.dtd file:
news.dtd