XML Data Binding in HTML web page


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. 

Binding XML data in web page
In this article a Web page is used in conjunction with mails.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 by using attributes.


First create an XML file called mails.xml like so:


<?xml version="1.0" encoding="utf-8" ?>




    <UserName>User Name 1</UserName>




    <UserName>User Name 2</UserName>




Next create an HTML file called mails.html like so:




    <title>User Names :: Cherukuri</title>



    <xml id="Mails" src="mails.xml" />

    <table datasrc="#Mails">




                <div datafld="UserID" /></td>





                <div datafld="UserName" />







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

The datasrc attribute sets or retrieves the source of the data for data binding from specified file. 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.