How to Create an XML AJAX App with Open Standards

Share your find

Data Integration & User Interaction with Open Standards

Open Standards and the W3C

On November 12, 1990 Sir Tim Berners-Lee @timberners_lee submitted a paper that would change the world, this paper was the WorldWideWeb: Proposal for a HyperText Project.  Sir Tim Berners-Lee leads the World Wide Web Consortium (W3C).  The W3C is an international community where Member organizations, a full-time staff, and the public work together to develop Web standards. Led by Web inventor Tim Berners-Lee and CEO Jeffrey Jaffe, W3C’s mission is to lead the Web to its full potential.  The W3C is having it’s very first Developer’s Conference (Free Streaming Video Available)  #W3Conf @w3cConf on November 15 – 16, 2011, “W3Conf Developer Conference“.

Data and Services Integration

Integration of heterogeneous data and services has always been a concern for creators and managers of services. With the emergence of the Web, the need for reusing data and services became even stronger, as the number of available services raised.

Cloud-based services are also created using different paradigms and present the same challenges as the ones found in Enterprise Services, or on the Open Web, and the opportunity to create mashups of services using different models.

There is currently extensive deployment experience with Web Services; the Semantic Web is more mature; and the XML Stack has become ubiquitous. The increasing use of JSON-based services and Cloud-based computing combined with experience and maturity of the XML-based services and of the Semantic Web technologies suggests that now is a good time to find ways to bridge and combine these various technologies to make a coherent platform for future business and technical work.  Additional information, reports, and presentations are available from this W3C Workshop.

A paper submitted by IBM to the W3C Data & Services Workshop describes the challenges of multiple data formats and possible solutions for loosely structured data, “Experiences with JSON and XML Transformations“.  This paper explains common problems developers and web service providers face when trying to develop a common interface.  The presenters identified many real-world key problems that left me wondering about a different solution that I hope others elaborate on here.

Web 2.0 App Model with XML AJAX API

Modern Web 2.0 Apps use Asynchronous JavaScript and XML (AJAX) to create dynamic interactive displays with data.  Many AJAX apps use JSON instead of XML.

What if they used Standard XML leveraging XPATH with cross-platform and language-independent DOM?  This approach could let us use object-oriented programming to work with object-oriented data.

The Data

The problem with loosely structured data is identifying target areas. This simple example of a book collection does not have unique identifiers in the data elements. Unique identifiers in the data elements would allow us to use standard methods to work with targeted areas.

The Data with NoDeCode Identifiers

This simple example of a book collection has unique identifiers in the data elements. The “XQuery Kick Start” book element now has a unique id, it’s author elements all have unique ids, along with every element in our XML data. Unique identifiers in the data elements allow us to use standard methods to work with targeted areas. No DeCode between JSON and XML is necessary with NoDeCode identifiers.

The NoDeCode identifiers are added as attributes to the XML DOM object with a few simple lines of code.

Simple AJAX Interfaces for Targeted XML DOM Objects

The NoDeCode supports connecting standard user interfaces to targeted data areas in the XML DOM Object supported by standard XPATH methods.  It is important to note that no round trips to the server are taking place at this time.  All the user interactions are taking place in the XML Object on the client.  The data can be manipulated and modified on the client, then the data object can be transformed into a string and posted to the server using standard HTTP protocol.

A screenshot of a simple delete books user interface

NoDeCode has been tested in the following web browsers:

  • Firefox 7
  • Google Chrome 15
  • Internet Explorer 8

NoDeCode Supports:

  • Standard HTTP protocol to get XML string
  • Method to convert XML string to XML object
  • Method to convert XML object to XML string
  • Methods/Properties to target loosely structured XML
  • Methods to connect User Interfaces to XML objects

The NoDeCode AJAX XML XPATH DOM Model demonstrates how to extend existing web browser objects and methods for custom needs.  It also shows how to use Object-Oriented JavaScript programming to create custom objects that can easily be extended to include new methods and properties.  NoDeCode contains many resources in it’s source code and was written in a single HTML page to support fast modifications and quick testing.  The source code along with a sample XML file can be downloaded here,

Please feel free to share your thoughts and comments here.