a. Post the code you have thus far (the file doing the "importing")
b.specify how you are accessing/loading your test page from the browser (ex: using http://localhost , file:///path/to/file, http://yoursite.com )
c. post a sample of the xml file you are trying to load.
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
loadXML() is for inline xml, not for a file. To load a file you need the load() method. Also, make sure the xml file is in the same folder as the page where you have the test page OR provide a full path to your xml file.
Don't forget to escape backslashes:
WRONG: var file="C:\somefolder\file.xml";
CORRECT: var file="C:\\somefolder\\file.xml";
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
The security settings on your IE might be preventing your script from working. Go to IE and click on:
Tools > Internet Options > Security > Local Intranet > Custom Level > Settings
> ActiveX Controls and plugins > Initialize and script ActiveX controls not marked as safe for scripting =>Enable
On the script you posted above, change loadXML() to load().
Then try it again.
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
You must be doing something wrong. I tried using the ajax approach and it works fine.
You are probably trying to get the responseXML from your ajax object, but there is no SERVER involved that "tells" the browser that the content IS xml. This is a well known issue in IE. Instead, you need to get the responseText from it, which should give you the xml as a string. Then use that string with the code you posted above( http://www.daniweb.com/forums/post1327817.html#post1327817 ), but instead of xmlDoc.loadXML("filters.xml") , you will need xmlDoc.loadXML(http.responseText)
NOTE: http a reference to the ajax object you will be creating.
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
that typically happens when you are trying to do CROSS domain request or CROSS protocol requests.
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
Let's take it one step at a time. Originally you said:
In Firefox everything works fine.
IE is able to load html pages through ajax call but not able to load xml document.
If upon completion of the ajax request you put: alert(page_request.responseText)
a. Do you see the xml string in FF?
b. Do you see the xml string in IE?
If you answered yes to both of them, then try the following changes:
...
if(page_request.status==200 || page_request.status==0) {
if(window.ActiveXObject && page_request.status==0)
{
page_request.responseXML.loadXML(page_request.restponseText);
}
responseHandler(page_request);
}
...
If you answered yes to "a", and no to "b" then your permissions are definitely to restrictive and you will have to ask the users to loosen it. They don't have to loosen the restrictions on the "Internet" zone, but they can do so in the "Local Intranet" zone.
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
OK so you are still NOT able to see anything via alert(page_request.responseText) when requesting an XML file. What about if you try an html file. It seems like originally you were able to do so. I've never come across an IE version where you can get the HTML contents but not the XML contents (verified via the responseText property of the ajax object).
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
I know you changed the permissions as I previously suggested just to see if what you had then worked fine (which it did), but I also know you then restored your permissions. Are you absolutely sure you restored your permissions correctly? Based on your original post, where you said "IE is able to load html pages through ajax call but not able to load xml document." It sounds like originally you were able to get the content via responseText, but now you seem to be getting permission denied. Does IE even prompt you if you want to run the 'active content' (the yellow bar that pops up at the top requiring you to click on it and decide whether allow the script to run)?
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244