[HELP] Learning XML with YUI

L

lee.munheng

Hi,

I'm trying to get the following code to work, but i keep getting a
"Data error." message instead of a table. Could somebody please tell
me what I'm missing?

Many thanks,
mh


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Meeting Room Booking System</title>

<link type="text/css" rel="stylesheet" href="yui/build/calendar/assets/
calendar.css">
<link type="text/css" rel="stylesheet" href="styles/style.css">
</head>
<body>
<div id="cal1Container"></div>
<div id="schContainer"></div>

<script type="text/javascript" src="yui/build/yahoo/yahoo.js"></
script>
<script type="text/javascript" src="yui/build/dom/dom.js" ></
script>
<script type="text/javascript" src="yui/build/event/event.js" ></
script>
<script type="text/javascript" src="yui/build/calendar/
calendar.js"></script>
<script type="text/javascript" src="yui/build/datasource/
datasource-beta-debug.js"></script>
<script type="text/javascript" src="yui/build/datatable/datatable-
beta-debug.js"></script>
<script type="text/javascript" src="yui/build/connection/
connection-debug.js"></script>
<script type="text/javascript" src="yui/build/logger/logger.js"></
script>

<script type="text/javascript">
var myColumnHeaders = [
{key:"time", text: "TiMe", type:"string",
sortable:true, resizeable:true},
{key:"comments", text: "Comments", type:"string",
sortable:true, resizeable:true}
];
var myColumnSet = new
YAHOO.widget.ColumnSet(myColumnHeaders);


var myDataSource = new YAHOO.util.DataSource("./
data.xml");
myDataSource.responseType =
YAHOO.util.DataSource.TYPE_XML;
myDataSource.responseSchema = {
resultNode: "bookings",
fields: ["time", "comments"]
};

var oConfigs = {
initialRequest: "index.html",
pageCurrent: 1,
rowsPerPage: 5,
startRecordIndex: 1,
rowSingleSelect: true
};

var myDataTable = new
YAHOO.widget.DataTable("schContainer", myColumnSet, myDataSource,
oConfigs);
</script>
</body>
</html>


<?xml version="1.0" encoding="UTF-8" ?>
<data>
<bookings>
<time>0700</time>
<comments>foo</comments>
</bookings>
<bookings>
<time>0800</time>
<comments>bar</comments>
</bookings>
</data>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top