jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes Input as xml in dojo unable to load Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Input as xml in dojo unable to load" Watch "Input as xml in dojo unable to load" New topic

Input as xml in dojo unable to load

jyothsna ananthula
Ranch Hand

Joined: Jun 02, 2011
Posts: 33
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>

I agree. Here's the link: http://aspose.com/file-tools
subject: Input as xml in dojo unable to load
jQuery in Action, 3rd edition