Browse DevX
Sign up for e-mail newsletters from DevX


Add Persistence to Your XML Data Islands-2 : Page 2




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Laying the Ground Work
To recap, displaying XML data in IE is easy. You place an XML data island inside your Web page using IE's proprietary <xml> element, bind form fields to the fields in the data using the data source object (DSO), and write some simple JavaScript functions that call the ADO MoveNext and MovePrevious methods.

The ease with which you can display XML data in IE lies in the fact that you can treat the data as either a Document Object Model (DOM) object or an Active Data Objects (ADO) record set. The DOM is an abstraction of how objects contained within an XML document relate to each other. In essence it is a tree whose base is the root node. You're probably already familiar with the DOM in HTML, where the root node is the document object. You reference all other objects/nodes on an HTML page through the root node -- the document object. When IE encounters an XML file, it builds a tree of node objects that you can reference in much the same way as HTML objects -- by using DOM methods to refer to a specific object/node in the tree. After you have a reference to the correct object/node, you can call DOM methods to manipulate it. This month, I'll show you how to update, add and delete records using both ADO and DOM and two different methods to save your data to the client's machine.

Last month I showed you a small phone book application. This month, I'll expand on that by using a much larger phone book XML document containing data for all the full time faculty at Norwalk Community College. There are over 250 records, which scales the problem up to reasonable real-world levels for an application of this type (view a read-only demo version). Except for the Save and Delete buttons, the code is very similar to last month's code (see Listing 1).

The code in Listing 1 contains a <style> declaration and a hidden form field.

<style type="text/css"> .storeUserData { behavior:url(#default#userData); } </style> <input type="hidden" value="null" id="savedData" class="storeUserData" />

You'll use those elements during the save process later in this article.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date