Dear Kendo UI Team,
I have been studying the KendoUI Web examples and currently having problems getting data from a remote XML feed. Here's the example that I'm refering to Binding to XML Data and below is my code. I simply replace the source from local to Books.xml on the demo site.
Code:
When I load the page, I don't get any data. Also, how can I see errors? Is there some code examples to display errors? Please advice. Thanks.
Gabe
I have been studying the KendoUI Web examples and currently having problems getting data from a remote XML feed. Here's the example that I'm refering to Binding to XML Data and below is my code. I simply replace the source from local to Books.xml on the demo site.
Code:
<
ul
id
=
"books"
></
ul
>
<
script
id
=
"template"
type
=
"text/x-kendo-template"
>
<
li
class
=
"book"
>
<
a
href
=
"#= url #"
>
<
h3
>#= title #</
h3
>
</
a
>
by #= author #
</
li
>
</
script
>
<
script
>
$(document).ready(function () {
function onChage() {
$("#books").html(kendo.render(template, this.view()));
}
// create a template using the above definition
var template = kendo.template($("#template").html());
var dataSource = new kendo.data.DataSource({
transport: {
// specify the XML file to read. The same as read: { url: "books.xml" }
},
schema: {
// specify the the schema is XML
type: "xml",
// the XML element which represents a single data record
data: "/books/book",
// define the model - the object which will represent a single data record
model: {
// configure the fields of the object
fields: {
// the "title" field is mapped to the text of the "title" XML element
title: "title/text()",
// the "author" field is mapped to the text of the "author" XML element
author: "author/text()",
// the "url" field is mapped to the text of the "url" XML element
url: "url/text()",
// the "cover" field is mapped to the "id" attribute of the "book" XML element
cover: "@cover"
}
}
},
change: onChage
});
dataSource.read();
});
</
script
>
When I load the page, I don't get any data. Also, how can I see errors? Is there some code examples to display errors? Please advice. Thanks.
Gabe