Click here to Skip to main content
13,049,814 members (63,415 online)
Click here to Skip to main content


32 bookmarked
Posted 21 Jan 2004

Writing ASP Chat using JavaScript and XML (Part 4)

, 21 Jan 2004
The last part of the ASP chat series. This article explains how to provide a chat with multiple rooms.
// LimitedXML class
 *  Class for storing and accessing shared data in XML.
 *  @param applicationIdentifier identifier for Application object to share data.
 *  @param nMax maximum quantity of items to store.
function LimitedXML(xmlNode, nMax) {
	this.add = LimitedXML_add;
	//this.getXMLDocument = LimitedXML_getXMLDocument; 
	// replaced with getWorkingNode()
	this.getWorkingNode = LimitedXML_getWorkingNode;
	this.getItems = LimitedXML_getItems;
	this.removeSuperfluous = LimitedXML_removeSuperfluous;
	this.xmlNode = xmlNode;
	this.xmlSection = "ITEM";
	this.nMax = nMax;

 *  Add new item.
 *  @param value value to add.
function LimitedXML_add(value) {
	var workingNode = this.getWorkingNode();
	var xmlDoc = workingNode.ownerDocument;
	var element = xmlDoc.createElement(this.xmlSection);
	var elementText = xmlDoc.createTextNode(value);

 *  Removes superfluous items.
 *  @param parentNode XML node for the root.
function LimitedXML_removeSuperfluous(parentNode) {
	var items = this.getItems();
	if(this.nMax < items.length) {

 *  Queries list of data items.
 *  @return XMLNodesList of managed items.
function LimitedXML_getItems() {
	var workingNode = this.getWorkingNode();
	var itemsList = workingNode.childNodes;
	return itemsList;

 *  Provides access to managed xml node.
function LimitedXML_getWorkingNode() {
	return this.xmlNode;
 *  Provides access and first time creation of shared XML Document.
 *  @return Shared FreeThreadedDOMDocument object.
/*function LimitedXML_getXMLDocument() {
	var xmlDoc = Application(this.applicationIdentifier);
	if(typeof(xmlDoc) == "undefined") {
		xmlDoc = Server.CreateObject("MSXML.FreeThreadedDOMDocument");
		var rootElement=xmlDoc.createElement("ROOT");
		Application(this.applicationIdentifier) = xmlDoc;
	return xmlDoc;
// LimitedXML class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Alexander Fedorenko
Web Developer
Ukraine Ukraine
Alexander Fedorenko is a professional C++ developer since 1996. He completed many custom and shareware projects. One of the successful projects is DevPlanner - tool for personal planning and time management.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Jan 2004
Article Copyright 2004 by Alexander Fedorenko
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid