Articles → .NET → Bind XML and HTML

Bind XML and HTML




















Software Requirement





Prerequisite knowledge















Creation of a new project





Click to Enlarge


Adding HTML and XML file in the project





Click to Enlarge


Adding code in XML file




<?xml version="1.0" encoding="utf-8" ?>
<Employees>
	<Employee>
		<EmployeeName>Anurag</EmployeeName>
		<EmployeeAddress>Noida</EmployeeAddress>
	</Employee>
	<Employee>
		<EmployeeName>Karan</EmployeeName>
		<EmployeeAddress>Gurgaon</EmployeeAddress>
	</Employee>
</Employees>



Adding code in HTML file




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title></title>
</head>

<body>
	<xml id="Employees" src="Employees.xml" async="false" />
	<table datasrc="#Employees">
		<tr>
			<td> <strong>Name</strong>: </td>
			<td>
				<div datafld="EmployeeName" /> </td>
		</tr>
		<tr>
			<td> <strong>Mail</strong>: </td>
			<td>
				<div datafld="EmployeeAddress" /> </td>
		</tr>
	</table>
</body>

</html>





Click to Enlarge


Output





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, July 26, 2012

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250