473,804 Members | 3,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems loading a local XML file with a local webpage

5 New Member
Hello,

I have designed a webpage mainly consisting in JavaScript code. It has to load an XML document's content when it is loaded so as to show a content depending on the XML data.

Both the HTML file and the XML file have to be stored locally on the computer and not on a server.

I only test in Internet Explorer, and the behaviour is very strange: on some machines, the XML file in well loaded, on some machines it isn't. I haven't seen this problem happening on IE6 and sometimes it happens on IE7, sometimes not... It happens under IE7 on my Vista Virtual Machine, It does not appear on my XP with IE6 and it does appear sometimes on XP with IE7 and sometimes not..
Here is the beginning of the function I use:

Expand|Select|Wrap|Line Numbers
  1. function loadFromXML()
  2. {
  3.     try
  4.     {
  5.         var request = null;
  6.         var xmlDoc = null;
  7.  
  8.         if (window.XMLHttpRequest) 
  9.         {
  10.             request = new XMLHttpRequest();
  11.                }
  12.  
  13.         else if (window.ActiveXObject) 
  14.         {
  15.                      request = new ActiveXObject("Microsoft.XMLHTTP");
  16.                }
  17.  
  18.                if (request) 
  19.         {
  20.             request.open("GET", "commentsDatas.xml"); 
  21.             request.onreadystatechange = function() 
  22.         {
  23.                  if (request.readyState == 4) 
  24.         {                                
  25.                     xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  26.             xmlDoc.loadXML(request.responseText);
  27.             var commentsList =    xmlDoc.getElementsByTagName("myComment");
...

If someone has an idea... I suspect that some security policy aspect is at stake but...
Thanks in advance!
Sep 18 '07 #1
7 9100
gits
5,390 Recognized Expert Moderator Expert
moved from js-articles section to js-forum ...
Sep 18 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Why use Ajax for reading the XML file?
Sep 19 '07 #3
babacrash
5 New Member
What would you suggest instead?
Thanks
Sep 19 '07 #4
epots9
1,351 Recognized Expert Top Contributor
What would you suggest instead?
Thanks
read this Tutorial to find out how.

good luck
Sep 19 '07 #5
rwaynes
4 New Member
read this Tutorial to find out how.

good luck
Hi
That Link fails....might have been interesting too!
Sep 21 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Hi
That Link fails....might have been interesting too!
Are you sure? It works fine for me? Maybe the website was temporarily unavailable.
Sep 21 '07 #7
babacrash
5 New Member
Thanks,
I'm going to have a look at this and I'll come back to tell if it fitted my needs.
Sep 21 '07 #8

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

Similar topics

4
5128
by: will | last post by:
Trying to modify some code from : http://www.faqts.com/knowledge_base/view.phtml/aid/2357 But having some problems. Cant work out how/why its not adding rows in the right place. seems strange to me. Im trying to get the NS code working first since that appears to be a bit harder to figure out.. heres my code.. http://www.sourceymonkey.com/tmp/upload.html I was guessing it was something to do with var f but playing around with that...
6
3974
by: Dave | last post by:
Hello, all! I'm having a small problem displaying an ordinary GIF file on my web site. It's just a banner with a transparent background. When I have Norton Internet Security disabled, it displays fine. When I enable Internet Security, the GIF disappears when I refresh the page - it doesn't even show an image placeholder. (Test was run with IE and Netscape). And you know what? I keep hitting refresh with Internet Security disabled, and...
2
2308
by: Jim Heavey | last post by:
Hello, I have a fairly simple application which reads none to many input files and edits them and if they are clean, it writes these transaction to the database. Any errors it finds, it opens and error file and writes the error message and the error transaction to this file. After the processing of the file is complete, it will copy the original file to an archive directory and then delete the original file. The problem is that after...
4
3287
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large and I need to implement some kind of "client side" lazy loading. What I mean is this: I want to display a grid that only shows, say, 20 records. I need an external scrollbar control that I can then show on the screen next to the grid. When...
23
5388
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser (Firefox) .... http://localhost/test3.php The script generates the following link using the echo statement ...
2
1872
by: linearfusion | last post by:
Hello, I may not have worded the subject correctly, but what I am trying to do is pull the XML data from the following stream, http://www.360voice.com/api/blog-getentries.asp?tag=changeagent&num=5, into a webpage. What I would like to do, or think I need to do is create a webpage that will pull the XML data from the above URL and write it to a local XML file. I would then like to apply an XSL stylesheet to the local XML file and...
1
7842
by: CSTechie | last post by:
I've been battling to install PEAR on Windows XP now for too long. I am not sure what I need to do. When I run go-pear.php from the command line, I get the error message as shown at the end. I included everything in case there is something there that's helpful. I'm trying to install PEAR so that I can use PHPUnit. Thanks for the help!!!!
2
2131
by: TuftyTrue | last post by:
Hi, On my site the user can browse to an image with <input type=file etc>. Althrough I have no problem swapping images with: document.getElementById('PictureToDisplay').src = URLtoPictureOnWebServer.src; I cant get it to work with:
1
3433
by: kevin.a.sweeney | last post by:
I would like to open an application from a hyperlink on a webpage. 1. the webpage is located on my local machine. 2. the application is located on my local machine. 3. the application will run on my local machine. In other words... The WEB is really not involved. What I have so far works with a Netscape Browser but what I really need is for it to work in the IE browser or one that I will create
0
9582
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
10580
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...
1
10323
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
10082
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...
0
9157
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
7621
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
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.