iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 9, 2008
Form Field Hints
EarthWeb.com
 
May 8, 2008
Meet The Hardy Heron: What's New in Ubuntu 8.04
OReilly Network
 
May 8, 2008
Does Enterprise Development Have to Be Painful? (Part Two)
OReilly Network
 
May 8, 2008
Perl Pragma Primer
WebReference.com
 
May 8, 2008
1 comment
.net
 
May 7, 2008
Poll: Do you check the download speed of the pages you build?
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /XML

HTML with XML Data Binding 

  Views:    41089
  Votes:    9
by Chief Programmabilities 3/03/05 Rating: 

Synopsis:

Use data binding to pull an XML file's content into a Web-page. (Running example: http://programmabilities.com/xml/contact.html.)
Pages: 
The Article

Data binding is a process that allows an Internet user to manipulate Web-page elements using an Internet Explorer Web browser. It employs dynamic HTML and does not require complex scripting or programming. 

   In this example a Web-page is used in conjunction with contact.xml to demonstrate Internet Explorer HTML data binding.  Without any scripting, this will pull data from the XML file and display it in the HTML page. This is considerably different than the XSLT that converts XML into HTML. 

   First off. Make an XML file called contact.xml like so: (See a working example of the XML file at http://programmabilities.com/xml/contact.xml.)

< ?xml version="1.0" ?>
<!--  Filename - contact.xml  --> 
<contact>
 <party>
  <name>Chief Programmabilities</name> 
  <email>bgates@programmabilities.com</email>
  <organization>Programmabilities</organization> 
  <address>1 Programmabilities Complex</address> 
  <phone>1-661-716-2564 x7678</phone> 
  <im>bgates@programmabilities.com</im> 
  <url>http://programmabilities.com/</url> 
  <p xmlns="http://programmabilties.com/contact.php">
    Contact</p> 
 </party>
</contact>


   Next off. Make an HTML file called contact.html like so: (See a working example of the HTML file at http://programmabilities.com/xml/contact.html.)

<html><header><title>Contact</title></header><body>
  <!-- Contact module -->
  <xml id="Contact" 
         src="http://programmabilities.com/xml/contact.xml"/>
  <table cellpadding="0" cellspacing="0" border="0" 
         datasrc="#Contact">
   <tr>
    <td><strong>Name</strong>:</td>
    <td><div dataFld="name"/></td>
   </tr>
   <tr>
    <td><strong>Address</strong>:</td>
    <td><div dataFld="address"/></td>
   </tr>
   <tr>
    <td><strong>Mail</strong>:</td>
    <td><div dataFld="email"/>
    </td>
   </tr>
   <tr>
    <td><strong>IM</strong>:</td>
    <td><div dataFld="im"/></td>
   </tr>
   <tr>
    <td><strong>URL</strong>:</td>
    <td><div dataFld="url"/></td>
   </tr>
  </table>
  <!-- END Contact module -->
</body></html>


   The contact.html file pulls the data out of your contact.xml file and puts it into your contact.html page using the technology called data binding

   The datasrc attribute sets or retrieves the source of the data for data binding. The dataFld attribute sets or retrieves which field of a given data source, as specified by the dataSrc property, to bind to the specified object. 

  NOTE: As of today, the Data Binding technology in this example does not work with Firefox.       


By Chief Programmabilities at Programmabilities.com

Pages: 

Similar/related articles:


 
  Sponsors