473,594 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml code working in internet explorer only

hi,

i am using the following code which works well in internet explorer
but not in firefox (and perhaps others too):

var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async="f alse";
xmlDoc.load("xm l/names.xml");
nodes = xmlDoc.document Element.childNo des
span_html = '<p>'
for (var i=0; i<nodes.length ; i++) {
name = nodes.item(i).f irstChild.text
span_html += 'name: '+name+'<br>';
}
span_html += '</p>';
can anybody tell me another way of writting this so it will work in
other browsers or better yet, so it will work in other browsers and
internet explorer? cheers

burnsy
Jul 23 '05 #1
3 2018
In article <65************ **************@ posting.google. com>,
bi******@yahoo. co.uk says...
hi,

i am using the following code which works well in internet explorer
but not in firefox (and perhaps others too):


You're using MS extensions to JavaScript.

http://www.sitepoint.com/article/xml-javascript-mozilla

--
Hywel http://kibo.org.uk/
I do not eat quiche.
Jul 23 '05 #2


mr_burns wrote:

i am using the following code which works well in internet explorer
but not in firefox (and perhaps others too):

var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
That stuff with ActiveXObject is geared towards IE/Win, it doesn't work
with Mozilla or Firefox or Opera, not even with IE/Mac.

If you want to load an XML document with Mozilla or with Opera 7.60
preview or 8.00 beta or with Safari 1.2 then you can use the
XMLHttpRequest object which is modelled after the Microsoft.XMLHT TP
object of MSXML.
Details are here:
<http://www.faqts.com/knowledge_base/view.phtml/aid/17226/fid/616>
<http://jibbering.com/2002/4/httprequest.htm l>
name = nodes.item(i).f irstChild.text


But note that text is not a property in the W3C DOM that Mozilla or
Opera implement, for a text node the nodeValue might give you what you
want, if you are looking at element nodes then you need to write a
function to collect the text of child nodes.
With DOM Level 3 there is the textContent property too, recent Mozilla
versions implement that but not Opera as far as I know.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
mr_burns wrote:
i am using the following code which works well in internet explorer
but not in firefox (and perhaps others too):
Definately in others as well. Konqueror for example will do nothing with
this code.
var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
See those magic words: "ActiveXObj ect" and "Microsoft" ... they are
synonymous. You get ActiveX with Microsoft and Microsot supplies
Microsoft. Firefox isn't Microsoft.
can anybody tell me another way of writting this so it will work in
other browsers or better yet, so it will work in other browsers and
internet explorer? cheers


Yup - you'll find lots of code (try SourceForge) that offers examples.
There are, basically, three standard ways of getting at XML data and the
one you want to use depends on what you want to do with the XML.
Unfortunately, the method you have used is not one of the three.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7633
by: esrkq | last post by:
Hi, I am looking at a way to return IP related information of a visitor loading a web page and found the following snippet of code: if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) { vartool=java.awt.Toolkit.getDefaultToolkit(); addr=java.net.InetAddress.getLocalHost(); host=addr.getHostName();
6
1516
by: bissatch | last post by:
Hi, I have been tryin to run free dhtml code from a web page. The web page is: http://dynamicdrive.com/dynamicindex14/pixelate.htm When I load the page above it opens as normal and the slide show automatically runs but when I open my own page that I have saved on my desktop, created from code from the above url, SP2 bar kicks in at the
10
1825
by: Don Munroe | last post by:
This one has me stumped. I have three web applications running on two different servers. The first that works fine is hosted by a .Net hosting company. Everyone that uses it has no problems hitting the site. The other two applications are running on my personal server which has Windows 2003, IIS 6, and .Net 1.1 Most of my users can use the sites. Two have come up with a very strange problem. They try to go to either application and...
3
1744
by: Craig Kenisston | last post by:
Hi, This is a silly question. I'm relatively new to asp.net and asp at all. But I always had this doubt. I'm working with Visual Studio and while exploring the ASPCommerce starter kit, when I switch from design view to html code view, I see many keywords underlied, like if they were invalid, however, they're not, they display fine and the project runs fine.
1
2288
by: alphanode | last post by:
When starting up my computer, I am able to open Internet Explorer windows and have them load without a problem, however once I open and run a .net project I am working on, this causes any new IE windows I open to freeze and not load. This includes trying to open up control panel or file explorer; however, the IE windows that I have opened before I ran the code will still work (I can still browse using them). I am working on this project...
6
2887
by: Sandy | last post by:
Hello - I have a little application that I would like to have an exit button on that closes my web application and closes Internet Explorer. What is the code that will do that? Any help will be greatly appreciated! --
9
5287
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from http://blogs.crankygoblin.com/blogs/geoff.appleby/pages/50712.aspx. I've also read the post on this topic by bggraphics, but he doesn't arrive at a final result. The main problem I am having is that the layerX and layerY event properties don't work. They're supposed to return the...
3
4002
by: TS | last post by:
I am using IE 7. I have a website running on my local machine (localhost) and auto complete doesnt work for any of the textboxes, but going to web sites on the internet does support this so i know the browser has this config turned on. any ideas why it doesnt work on my local web application (.net 2)? thanks
5
2113
by: mukeshrasm | last post by:
Hi I am using AJAX to display the value in selection/list box. this code is working fine in Firefox Mozila browser but it is not working in Internet Explorer so please tell me how this will work in both' for html <html> <head> <script src="addlist.js" type="text/javascript"></script> </head>
0
7946
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
8251
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
8372
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...
1
8003
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
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...
0
3859
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
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.