473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IE7 and FF to read XML file from ISP

3
Hello,
I need some help to solve the following problem. I wrote some html/javascript code to read data from an XML file:

XML file:
<places>
<place year="2000" name="Amsterdam" />
<place year="2000" name="Amstelveen" />
</places>

html/javascript code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>XML Test
</title>
<style type="text/css">
</style>
<script language="JavaScript" type="text/javascript">

var xmlDoc;
function load () {
//for IE7
if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.onreadystatechange = IE_verify;
xmlDoc.load("places.xml");
var xmlObj = xmlDoc.documentElement;
Show (xmlDoc);
}
//for FF
else if (document.implementation && document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument("","",null) ;
xmlDoc.async = false;
xmlDoc.onload = function (evt) {Show (xmlDoc);};
xmlDoc.load("places.xml");
}
}

function IE_verify(xmlDoc) {
// 0 Object is not initialized
// 1 Loading object is loading data
// 2 Loaded object has loaded data
// 3 Data from object can be worked with
// 4 Object completely initialized
if (xmlDoc.readyState != 4) {
return false;
} else {
return true;
}
}

function Show (xmlDoc) {
var places = xmlDoc.getElementsByTagName ("place");
var count = places.length;
var Place = new Array();
for (var i=0; i<count; i++) {
Place [i] = new Array (
places[i].getAttribute ("year"),
places[i].getAttribute ("name"));
document.writeln (Place[i][0]
+ ", " + Place[i][1]
+ "<br>");
}
}
</script>
</head>

<body onload="load()">
</body>
</html>

This runs for IE7 and FireFox nicely locally on my PC. However, if I upload it to my homepage, then only IE7 displays the data; there is no data displayed in FireFox, no errors on the FF error console.
Who knows what's wrong?
Sep 11 '07 #1
0 1433

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: lovecreatesbea... | last post by:
The condition at line 31 is added to check if the program finished to read the whole file. Is it needed and correct? Thank you. #include <fstream> #include <iostream> #include <string> using...
0
by: lovecarole | last post by:
hi, i am the student who should write a program about reading wav file and do the DFT. actually i don't know how to read data of the wav song and save it into the array... if i want to read...
6
by: Thomas Kowalski | last post by:
Hi, currently I am reading a huge (about 10-100 MB) text-file line by line using fstreams and getline. I wonder whether there is a faster way to read a file line by line (with std::string line)....
9
by: flebber | last post by:
I was working at creating a simple program that would read the content of a playlist file( in this case *.k3b") and write it out . the compressed "*.k3b" file has two file and the one I was trying...
2
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.