XML

Initial Data

As initial data we'll take 3 books:

  • “War and Peace” by Leo Tolstoy
  • “Hamlet” by William Shakespeare
  • “Madame Bovary” by Gustave Flaubert

Configuration

In XML the data will look as:

 
Please note, you can set item's id directly in XML file

books.xml

<?xml version="1.0" encoding="UTF-8"?>
<data>
 <item id="1">
   <name> War and Peace </name>
   <author> Leo Tolstoy </author>
 </item>  
 <item id="2">
   <name> Hamlet </name>
   <author> William Shakespeare </author>
 </item> 
 <item id="3">
   <name> Madame Bovary </name>
   <author> Gustave Flaubert </author>
 </item> 
</data>

HTML Code

list(xml).html

<!DOCTYPE HTML>
<html>
	<head>
	<link rel="stylesheet" href="../../../codebase/touchui.css" type="text/css" media="screen" charset="utf-8">
		<script src="../../../codebase/touchui.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
              <script type="text/javascript" charset="utf-8">
 
	      dhx.ui({
                    view:"list",
                    url:"xml/books.xml", 
                    datatype:"xml",
		    template:"#name# (#author#)", 
                    select:true, 
                    type: {width: 300}
              });    
	      </script>
 
	</body>
</html>