Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > RSS and Atom
|
RSS and Atom Ask questions, get answers, discuss creating RSS and Atom feeds or programming apps or sites that create or consume RSS/Atom. Please leave any RSS/Atom politics out of this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the RSS and Atom section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2006, 09:24 AM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default responseXML in IE

Hi all,
Please help me out of this quagmire,

I have an application in which i retrieve data from XML file named, data.xml, and display it in TRs in html page, named ajaxexample.html.

It is working fine in Firefox, but seems to have some issues in IE.

The content of html file is as below:


<!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">

<script type="text/javascript"><!--
function ajaxRead(file){
var xmlObj = null;
if(window.XMLHttpRequest){
xmlObj = new XMLHttpRequest();
} else if(window.ActiveXObject){
xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
return;
}
xmlObj.onreadystatechange = function(){
if(xmlObj.readyState == 4){
processXML(xmlObj.responseXML);

}
}
xmlObj.open ('GET', file, true);
xmlObj.send ('');
}
function processXML(obj){
var dataArray = obj.getElementsByTagName('pet');
var dataArrayLen = dataArray.length;
var insertData = '<table style="width:150px; border: solid 1px #000"><tr><th>'
+ 'Pets</th></tr>';
for (var i=0; i<dataArrayLen; i++){
insertData += '<tr><td>' + dataArray[i].firstChild.data + '</td></tr>';
}
insertData += '</table>';
document.getElementById ('dataArea').innerHTML = insertData;
}
//--></script>
</head>
<body>
<h1>Developing Web Applications with Ajax</h1>

<p>This page particularly demonstrates the retrieval and processing of grouped sets of XML data.
The data retrieved will be output into a tabular format below.
<a href="#" onClick="ajaxRead('data.xml'); return false">See the demonstration</a>.</p>
<div id="dataArea"></div>
</body>
</html>


The content of xml file (data.xml):
<?xml version="1.0" encoding="UTF-8"?>
<data>
<pets>
<pet>Cat</pet>
<pet>Dog</pet>
<pet>Horse</pet>
</pets>
</data>

Please help me out.

Thanks in advance






Similar Threads
Thread Thread Starter Forum Replies Last Post
ResponseXML property of XMLHTTPRequest Object prashantshekhar BOOK: Beginning Ajax with ASP.NET 0 August 14th, 2007 12:49 AM
responseXML in IE tannu XML 1 February 9th, 2006 12:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.