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

returning xml document function

107 100+
Hi,

A simple function to return an xml document given its path:

Expand|Select|Wrap|Line Numbers
  1. function loadXML(xmlpath)
  2. {
  3.     // code for IE
  4.     if (window.ActiveXObject)
  5.     {
  6.         xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  7.         xmlDoc.async=false;
  8.         xmlDoc.load(xmlpath);
  9.         return xmlDoc;
  10.     }
  11.     // code for Mozilla, Firefox, Opera, etc.
  12.     else if (document.implementation &&    document.implementation.createDocument)
  13.     {
  14.         xmlDoc = document.implementation.createDocument("", "", null);
  15.         xmlDoc.load(xmlpath);
  16.         return xmlDoc;
  17.     }
  18.     else
  19.     {
  20.         alert('Your browser cannot handle this script');
  21.         return null;
  22.     }
  23. }

this seems to work in internet explorer but not firefox. Can anyone shed any light on this?

cheers

Andy
Aug 10 '07 #1
4 1609
epots9
1,351 Expert 1GB
Hi,

A simple function to return an xml document given its path:

Expand|Select|Wrap|Line Numbers
  1. function loadXML(xmlpath)
  2. {
  3.     // code for IE
  4.     if (window.ActiveXObject)
  5.     {
  6.         xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  7.         xmlDoc.async=false;
  8.         xmlDoc.load(xmlpath);
  9.         return xmlDoc;
  10.     }
  11.     // code for Mozilla, Firefox, Opera, etc.
  12.     else if (document.implementation &&    document.implementation.createDocument)
  13.     {
  14.         xmlDoc = document.implementation.createDocument("", "", null);
  15.         xmlDoc.load(xmlpath);
  16.         return xmlDoc;
  17.     }
  18.     else
  19.     {
  20.         alert('Your browser cannot handle this script');
  21.         return null;
  22.     }
  23. }

this seems to work in internet explorer but not firefox. Can anyone shed any light on this?

cheers

Andy
does firefox give u an error or it doesn't say anything?
Aug 10 '07 #2
theS70RM
107 100+
does firefox give u an error or it doesn't say anything?

It returns an empty xml document. =(

any ideas?
Aug 13 '07 #3
epots9
1,351 Expert 1GB
what is the code that xml document is being returned to?
Aug 13 '07 #4
theS70RM
107 100+
what is the code that xml document is being returned to?
i'll set up a sample to show the problem asap then repost ;-)
Aug 18 '07 #5

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

Similar topics

1
by: Deidre | last post by:
I am having a weird problem. I have an application thats default.aspx page is a menu page when a menu item is selected the requested page is loaded into default.aspx using iframes. When unsaved...
5
by: J Lake | last post by:
I am working on a simple orderform script to keep a running total, however I am encountering some errors. function CalculateTotal() { var order_total = 0 // Run through all the form fields...
1
by: brianj7675 | last post by:
Basically i'm trying to write a previous next link in order to go to the next page in my database(similar to google's with numbers in the middle for pages the user wants to jump to. My only...
8
by: Michal Nazarewicz | last post by:
Hi, What does returning 0 from main() mean according to C89/C90 standard? I've found that in C99 it means successful termination (7.20.4.3p5) however as I'm editing book on C at Polish Wikibooks...
5
by: salvador | last post by:
I'm trying to create a function to return some values from a php script. The php script is returning the correct values if called from a browser window. However, the function that I'm using never...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
4
omerbutt
by: omerbutt | last post by:
hi there i am making an application in which i have a drop down menu which onchange passes a value(this.value) to a js function which gets the value and calls an ajax routine and passes that value...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
160
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
1
by: Constantine AI | last post by:
Here is the situation i am currently trying to update a sales order using PHP and javascript. When you click on the edit button it brings you a new site page with existing sales order details within....
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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.