• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Input as xml in dojo unable to load

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the following example anything mistake i am unable to load xml url.while running this getting error as lookup fail and unable to load
../WEB-INF/books.xml.please help me out as soon as possible

Document : xmltotreegrid
Created on : Jun 23, 2011, 11:53:07 AM
Author : JA0084604

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">

<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">

//This function performs some basic dojo initialization. In this case it connects the button
//onClick to a function which invokes the fetch(). The fetch function queries for all items
//and provides callbacks to use for completion of data retrieval or reporting of errors.
function init3() {
//Function to perform a fetch on the datastore when a button is clicked
function search() {
var queryObj = {};

//Build up the query from the input boxes.
var isbn = isbnBox.getValue();
if (isbn && dojo.trim(isbn) !== "") {
queryObj["isbn"] = isbn;

var qNode = dojo.byId("query");
if (qNode) {
qNode.innerHTML = dojo.toJson(queryObj);

//Callback to perform an action when the data items are starting to be returned:
function clearOldList(size, request) {
var list = dojo.byId("list3");
if (list) {
while (list.firstChild) {

//Callback for processing a returned list of items.
function gotItems(items, request) {
var list = dojo.byId("list3");
if (list) {
var i;
for (i = 0; i < items.length; i++) {
var item = items[i];
list.appendChild(document.createTextNode("ISBN: " + bookStore.getValue(item, "isbn") + " TITLE:" + bookStore.getValue(item, "title")));

//Callback for if the lookup fails.
function fetchFailed(error, request) {
alert("lookup failed.");

//Fetch the data.
query: queryObj,
onBegin: clearOldList,
onComplete: gotItems,
onError: fetchFailed

//Link the click event of the button to driving the fetch.
dojo.connect(button3, "onClick", search);
//Set the init function to run when dojo loading and page parsing has completed.
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"

<body class=" claro ">
<input dojoType="dijit.form.TextBox" jsId="isbnBox" value="*">
<div dojoType="dojox.data.XmlStore" jsId="bookStore" url="../WEB-INF/books.xml">
<div dojoType="dijit.form.Button" jsId="button3">
Click to search!
Query used:
<span id="query">
</span <br>
Books located:
<span id="list3">
<!-- NOTE: the following script tag is not intended for usage in real
world!! it is part of the CodeGlass and you should just remove it when
you use the code -->
<script type="text/javascript">
dojo.addOnLoad(function() {
if (document.pub) {


xml in WEB_INF/books.xml i created as follows
<?xml version="1.0" encoding="UTF-8"?>

Document : books.xml
Created on : June 23, 2011, 12:12 PM
Author : JA0084604
Purpose of the document follows.

<?xml version="1.0" encoding="ISO-8859-1"?>
<title>Title of 1</title>
<author>Author of 1</author>
<title>Title of 2</title>
<author>Author of 2</author>
<title>Title of 3</title>
<author>Author of 3</author>
<title>Title of 4</title>
<author>Author of 4</author>
<title>Title of 5</title>
<author>Author of 5</author>
<title>Title of 6</title>
<author>Author of 6</author>

For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic