473,766 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML file load for FireFox

3 New Member
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="Amstelvee n" />
</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:sc hemas-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="JavaS cript" type="text/javascript">

var xmlDoc;
function load () {
//for IE7
if (window.ActiveX Object) {
xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async = "false";
xmlDoc.onreadys tatechange = IE_verify;
xmlDoc.load("pl aces.xml");
var xmlObj = xmlDoc.document Element;
Show (xmlDoc);
}
//for FF
else if (document.imple mentation && document.implem entation.create Document) {
xmlDoc = document.implem entation.create Document("","", null);
xmlDoc.async = false;
xmlDoc.onload = function (evt) {Show (xmlDoc);};
xmlDoc.load("pl aces.xml");
}
}

function IE_verify(xmlDo c) {
// 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.readySt ate != 4) {
return false;
} else {
return true;
}
}

function Show (xmlDoc) {
var places = xmlDoc.getEleme ntsByTagName ("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.writel n (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 8 '07 #1
3 7401
drhowarddrfine
7,435 Recognized Expert Expert
I don't remember much from studying xml but if you are using the xmlns, don't you have to use the xml declaration on the first line? But then the problem would be that IE doesn't recognize xhtml.
Sep 9 '07 #2
robudo
3 New Member
I don't remember much from studying xml but if you are using the xmlns, don't you have to use the xml declaration on the first line? But then the problem would be that IE doesn't recognize xhtml.
Yep, I tried the xml on the first line as well; makes no difference.
And the 'strange' thing is, that all (IE + FF) works well on local PC. IE7 works from the internet provider home-page correctly, FF doesn't :O(
Sep 9 '07 #3
JosAH
11,448 Recognized Expert MVP
I'll move this thread to the XML forum where it belongs, ok?

kind regards,

Jos
Sep 19 '07 #4

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

Similar topics

4
2302
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load. My CSS file works fine in IE 6.0 when i specify the absolute path. eg- href ="D:\Mywebsite\css\mycssfile.css" but this full path does not work in firefox 1.5.0.5. When I load page in firefox, css file seems to have no effect on page. If I...
6
4038
by: laramie.hartmann | last post by:
I have a script (see below) that accesses a XML file and displays the contents through a series of document.write calls. This all works fine in IE, but not at all in Firefox. I get no errors in the javascript console, but when I try to load the elements by tag name and look at the length it is always 0 as if no elements have been added. Any suggestions are greatly appreciated as I've been stuck on this for a while now. Thanks,
1
2858
by: FreeXenon | last post by:
OK, I am having a lot of problems loading an XML file via a Server-Side JavaScript based ASP page. Below is the code that I am using as well as the different methods of loading the XML file and the associated errors that I am getting from the process. =( Now the original XML file is generated from a Java based Lotus Notes Agent. I have tested the XML output in IE/FireFox/Opera which opens up and displays the output just fine as XML. I have...
1
8117
by: awolfe76 | last post by:
The xml and javascript are below. IE finds everything fine, Firefox gives the following error - xmlDoc.getElementsByTagName("lab_name") has no properties on this line - alert(xmlDoc.getElementsByTagName('lab_name').childNodes.nodeValue); I am using Firebug to help me debug. When I look at the DOM right after the page loads the childNodes part of my xmlDoc tree is empty, this explains why I get the error. But why is it empty????!!!!! It...
8
14497
by: SM | last post by:
Hello, I wrote a Javascript function that loads a xml file to access the data. After the loading of the xml file, the function init() is called (for testing purposes im only returning the number of elements) The loading executes ok for IE and the init() function returns the correct numbers of elements. When i try to load the xml file in Firefox, the init() function executes but the number of elements is always 0. I guess is because
7
3009
by: psybert | last post by:
Hello everyone, Long time lurker, first time poster. I'm a beginner coder, and I've taught myself everything with the help and expertise of users and websites like this one. I normally figure out any problem, but this one really has me stumped. Basically, I have created a site that initially loads a set of "items" and their values into 17 drop down menus from an XML file. Each of those "items" when selected from the drop down menu loads...
0
1446
by: robudo | last post by:
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:
2
3091
by: willyWEB66 | last post by:
Hi everyone, I have this code in javascript where the XML file is loaded and displayed to an html using XSLT. It works fine in IE but not in Firefox. My problem is in the looping to the childNodes. It seems that Firefox does not recognize this line of code >> xmlDoc.getElementsByTagName("urlValue").childNodes.nodeValue I'm not sure if this is the line that is not working, or the lines before it. I'm looping to the childNodes to compare to...
4
3873
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I am using a master page senerio. The erro I'm getting is 'busyBox' is not a member of 'ASP.login2_aspx'
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10008
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9837
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.