Home
Documentation
Case Studies
Sample Code
Test Suites
History
Tools
Download
Cross Platform XML Parsing in JavaScript

XML for <SCRIPT> is a simple, non-validating XML DOM and SAX parser written in JavaScript. It was designed to help web application designers implement cross platform, client side manipulation of XML data. XML for <SCRIPT> is licensed under the terms of the GNU Lesser General Public Licence (LGPL)

The ultimate goal of n-tier architecture is to separate the content of an application from its presentation. Unfortunately, most server-side technologies in use today do not make this goal easily attainable. It is not uncommon to see code such as the following in server-side scripts:

<input type="text" value="<%out.println(vrblName);%>">

XML for <SCRIPT> seeks to simplify web site development by providing web application developers the ability to send the content of their application in XML while the presentation is sent in HTML and style sheets. When the onload event of the body is called, JavaScript routines can use the XML parser to retrieve the initial values for the form elements and set them appropriately.

It is also common to use the XML Parser as a disconnected client-side database. This scenario is outlined in the modern browser sample application. In this application, an XML string representing a list of users is sent to the browser. The user then can manipulate this XML string as he or she sees fit, completely independent of the server. When the user is finished manipulating the data, the new XML string can then be sent back to the server. Since the data exchange is in 100% XML, the server can then process the new string with its own parser and take the appropriate actions.

The benefits of this architecture are many.

- Server side code intermixed with HTML code can be reduced to almost nothing.
- Client side code is simplified by having all form initialization in one place
- Applications are now free to maintain their own data, reducing annoying round-trips to the server
- Server side processing is simplified by having all relevant form data be submitted in XML

In effect, XML for <SCRIPT> allows n-tier client side application development to become a reality.