XML Message Board

Submitted on: 1/5/2015 10:17:00 AM
By: Jamie Band (from psc cd)  
Level: Advanced
User Rating: By 5 Users
Compatibility: ASP (Active Server Pages)
Views: 2972
     A Message Board System implemented in ASP using XML/XSL. This articles serves to demonstrate the implementation of an XML system using ASP/MSXML-3/XSL

This article has accompanying files

An XML Messsage Board System

An XML Messsage Board System

by Jamie Band, Stimulus Software Architects

As part of my quest to learn more about XML and its associated technologies, I decided to implement an XML message board system. It serves as useful example to others learning the technology and to those who simply would like to incorporate a message board system into their website (without having to install an expensive SQL database).

The downloadable archive contains the following files:  

Default.htm The main page leading to others
Global.asa Contains application scope logic (loading XML doc)
Post.asp HTML form for entry of new messages
Reply.asp HTML form for entry of message replies
Viewmessage.asp ASP logic for displaying a single message
Viewmessage.xsl XSL stylesheet for displaying a singlemessage
Viewmessagelist.asp ASP logic for displaying hierarchical list of messages
Viewmessagelist.xsl XSL stylesheet for displaying hierarchical list of msgs
Submitmessage.asp ASP logic for inserting a message in the message tree XML Schema for the messageboard.XML
Messageboard.xml XML file created by ASP logic to store messages

To install and run this XML application on your own system you will need:

  • An ASP enabled web server such as Internet Information Server
  • Microsoft’s XML parser (MSXML 3.0 beta and higher)

  You’ll need to configure your web server’s file write access permissions in the directory where you install the above files. This can be a little tricky in IIS so be sure read the IIS documentation to find out how.

  A message board system is suited to XML implementation, because it is inherently a hierarchical system.


A message is contained within a message group. A reply to a message is neatly contained within its original message.  This simple structure is used to define a message tree. The entire message tree is stored in the XML flat file “messageboard.xml”.

  The information contained in the message tree is displayed in an appropriate format using XSL style sheets.  This example does not rely on the presence of an XML/XSL capable browser. It uses XSL processing on the server-side to output HTML for legacy browser compatibly. However the example could just as easily be modified to support XSL processing on the client.

  The root node (“messageboard”) in the XML message tree is constructed in the Application_OnStart method of global.asa supposing no messages have been posted.  The DOMDocument object is therefore defined at application-level scope, meaning that multiple users access the same document tree in memory.

Each message in the message board contains the following attributes:

            Subject = the subject of the message
            Nick = the nickname of the person who wrote the message
            Id = a unique identifier associated with the stored message
            PostDt =  the time and date when the message was posted           

  The file “submitmessage.asp” contains ASP the logic for inserting a message node into the message tree, in response to new post and reply to message operations. 

  The XSL stylesheets viewmessagelist.xsl, and viewmessage.xsl, display a list of hierarchical messages in a message group and the contents of a message, respectively.

  XSL parameters are used extensively, for example, to display a particular message associated with a message Id, the viewmessage.xsl stylesheet includes the tag:

  <xsl:param name="msgid"/>   

  The above msgid parameter is supplied prior to XSL processing in the ASP script:

xslproc.addParameter "msgid",CStr(id)

  where id contains the unique id of the message to be displayed.

  Message IDs are used to locate messages in the message board, using the nodeFromID() method available in the MSXML-2 XMLDOMDocument object.

  By far the most interesting style sheet is viewmessagelist.xsl. The style sheet displays the message hierarchy by recursively applying message templates and using the HTML DIV tag to format the output in an indented fashion.

  There are a number of useful extensions that can be added to this example, if you’re keen to beef up your XML expertise:

  • Implement a search function enabling users to find messages on the message board
  • Incorporate message count statistics for each message group
  • For each user (nick) supply information on which messages have been read / not read
  • Link up message groups from different sources (i.e. web sites)

I hope you find this example useful. If you have any questions or suggestions you can reach on


Jamie Band is a Systems Architect at Stimulus Software in Johannesburg, South Africa.

You can reach him on or +27-83-412-5975


winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.