Link to home
Start Free TrialLog in
Avatar of vbrnair
vbrnair

asked on

Loading local Xml file into a data island

In IE5, is it possible to load an .xml file present on the user's local disk.  I tried the following

A.  var xmlDoc;
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.load("file://c:/xyz.xml");

    I get Error:Access is denied.

B.  Declaring a data island within the HTML body
    <XML ID="xmlData" SRC="file://c:/xyz.xml"></XML>

    ... nothing happens.  If SRC points to an xml
    file on the web server everything is fine.

Can anybody help?

Thanks,
-VJ
Avatar of MicOfLZ
MicOfLZ

hi vj

I think this is a permission issue. the browser tries to open the file as the internet user.
you'll have to set appropriate permissions.

hope this helps
MicOfLZ
There shouldn't be a problem , try to do with out the "file://"  thing , just put it in one direcotry , then on the same directory create a test page that would have something :
<XML ID="xmlData" SRC="file.xml"/>

The "file://"  is acts differently in different sub-versions of IE , this is why I wouldn't suggest using it in a code.

I'm pretty sure that you do not have access to XML files on a users local disk...if you would it would indeed be a serious security hazard....

Max.
hi avner

if I'm not completely wrong now, this one:

<XML ID="xmlData" SRC="file.xml"/>

loads the file from the web server rather than from the clients hard disk.
by the way, my first comment is rubbish. I think that DreamMaster is right by reviewing the question.

Cheers
MicOfLZ
MicOfLZ and DreamMaster ,

There is a simple question here :
I started by basically thinking that when "vbrnair" say he tried this :
xmlDoc.load("file://c:/xyz.xml");

He tried this on his computer (when he is both server and client).

What you are suggesting is that he was trying to load this from a distanced client.

If the second option is the right one , then obviously it's a permission problem.

avner.
ASKER CERTIFIED SOLUTION
Avatar of DreamMaster
DreamMaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
DreamMaster ,

You are 100% correct , and there for we are back to  your first comment "Security reason" , and that is the correct answer.


vbrnair, forgive me if I managed to confuse you , DeamMaster has answerd the only possible answer and is well deserved the points.

avner.

LOL.... :-)

Max.
Finalized by EE Moderator
Thanks Moondancer.. :)

Max.
Happy to help, always sorry to see abandoned questions when help was requested and given.
Moondancer - EE Moderator