Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Displaying XML Data Islands with JavaScript-2 : Page 2


advertisement
Creating an XML Consumer
An XML consumer is any page that uses or "consumes" XML data. The process to create an XML consumer is straightforward:

  1. Create (or obtain) the XML data source
  2. Create the data island inside your Web page
  3. Bind data fields to the data island
  4. Create a mechanism for navigating through the records
Create the XML Data Source
The application you'll create is a simple employee directory. The XML data for the application is admittedly incomplete when compared to that typically received from a relational database (there's no primary key, for example) but it is sufficient for demonstration purposes. The cool part about the EmployeeDirectory application is that the application does not have to reside on a Web server—it works as a stand-alone client-side application. IE5 instantiates an XML Data Source Object (DSO) and lets you manipulate the data either as a DOM object or as an ADO recordset.

Open up your favorite text editor and create the following XML document:

<?xml version="1.0"?> <employees> <employee> <lastName>Smith</lastName> <firstName>Jill</firstName> <title>President</title> <department>All</department> <extension>160</extension> </employee> <employee> <lastName>Roberts</lastName> <firstName>William</firstName> <title>Vice President</title> <department>Marketing</department> <extension>175</extension> </employee> <employee> <lastName>Gonzalez</lastName> <firstName>Alejandra</firstName> <title>Vice President</title> <department>Sales</department> <extension>188</extension> </employee> <employee> <lastName>Billiker</lastName> <firstName>Brian</firstName> <title>Senior Software Architect</title> <department>Information Systems</department> <extension>176</extension> </employee> <employee> <lastName>Williamson</lastName> <firstName>Tara</firstName> <title>Account Manager</title> <department>Sales</department> <extension>196</extension> </employee> </employees>

Save the file as data.xml in a clean directory (all of the files for the Employee Directory application will reside in the same folder). That completes the first phase!


Comment and Contribute

 

 

 

 

 


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

 

 

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