473,387 Members | 1,790 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,387 software developers and data experts.

Q: Mozilla, XML and JavaScript

JF
Hi,

can somebody give me a minimal example of how to read xml
file into mozilla AND run some Javascript funcion?

Mozilla can read xml files directly and css files can
be included as well, that works for me.
But I would like to do some operations with the DOM tree.

My question is Mozilla only, I would apperciate some
minimal example (like alert(1)) and especially some
URL pointers.

Thanks,
Josef

Jul 20 '05 #1
2 3154


JF wrote:
can somebody give me a minimal example of how to read xml
file into mozilla AND run some Javascript funcion?

Mozilla can read xml files directly and css files can
be included as well, that works for me.
But I would like to do some operations with the DOM tree.

My question is Mozilla only, I would apperciate some
minimal example (like alert(1)) and especially some
URL pointers.


Mozilla implements the XMLHttpRequest object that implements the same
interface that Msxml2.XMLHTTP implements, so an example to load an XML
file is

var httpRequest = new XMLHttpRequest();
httpRequest.open('GET', 'test20031204.xml', true);
httpRequest.onreadystatechange = function (evt) {
if (httpRequest.readyState == 4) {
var xmlDocument = httpRequest.responseXML;
alert(xmlDocument.getElementsByTagName('*').length );
}
}
httpRequest.send(null);

The XML file at the URL test20031204.xml is loaded asynchronously, on
readyState of the request object is 4 you can access the responseXML
object which is W3C DOM Level 2 document you can script. The example
simply counts the elements in the document.

See also the XML section on http://javascript.faqts.com/
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
"JF" <jf***@ics.muni.cz> wrote in message news:Hp********@news.muni.cz...
Hi,

can somebody give me a minimal example of how to read xml
file into mozilla AND run some Javascript funcion?

Mozilla can read xml files directly and css files can
be included as well, that works for me.
But I would like to do some operations with the DOM tree.

My question is Mozilla only, I would apperciate some
minimal example (like alert(1)) and especially some
URL pointers.

Thanks,
Josef

Some useful links:

http://www.webreference.com/programm...per/index.html
http://forums.devshed.com/t51667/s.html
Jul 20 '05 #3

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

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
2
by: For Example: John Smith | last post by:
Hello! Javascript beginner here, looking for some help. I discovered this problem tonight while playing with my site using Mozilla. I don't have Netscape on this computer but I assume this...
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
2
by: wylbur37 | last post by:
I normally use Mozilla 1.4 on Windows XP Pro. As I was developing some test webpages, I discovered that the SRC parameter doesn't seem to work when a path is used with the filename. In one...
3
by: kaith | last post by:
The following code used to popup a window when I used netscape 4.79. Now I switched to mozilla 1.4 and the window doesn't popup. function newWindow(newContent) { winContent...
3
by: kj | last post by:
This problem is driving me nuts. The code at the end of this post below works fine with IE, but fails with Mozilla. You can see it in action at http://tinyurl.com/2jvo3 With Mozilla 1.4 and...
9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
6
by: Erik Steffl | last post by:
I am trying to create a simple custom web spider using mozilla and javascript, the basic functionality is to open a website and then manipulate it using DOM (possibly opening links etc.). it...
3
by: James | last post by:
I've been looking at the Mozilla source (1.8b1) and I thought that there I might find definitions of the various client-side JavaScript objects (e.g. history, navigator). Has anyone managed to...
20
by: Thorsten Kampe | last post by:
Hi, I've already sent this to the Komodo mailing list (which seemed to me the more appropriate place) but unfortunately I got no response. I'd like to build a Python GUI app. Neither Tkinter...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.