Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 10, 2012 02:05 AM by GMann
Member
406 Points
519 Posts
Nov 09, 2012 07:06 PM|LINK
Hi:
I am trying to read an xml file located at c:\books.xml like so
xml = loadXMLDoc("c:/books.xml");
The code can't seem to find it ?
function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET", dname, false); xhttp.send(""); return xhttp.responseXML;
} I am getting Jscript error when I try and open my file with : xhttp.open("GET", dname, false);
Thanks for your help
301 Points
67 Posts
Nov 09, 2012 08:27 PM|LINK
The open method, you are calling as xhttp.open() is used to request data from a URL on a server.
You are attempting to open a local file. That is invalid.
Contributor
2066 Points
416 Posts
Nov 09, 2012 09:57 PM|LINK
This link may help
http://social.msdn.microsoft.com/Forums/en/netfxjscript/thread/29a2f351-5bb2-4edd-ac19-c2e4d3b6f4d0
Regards
Nov 10, 2012 02:02 AM|LINK
Thanks
Nov 10, 2012 02:05 AM|LINK
Thanks;
I found the answer, i ran across some windows documentation which memtioned the 'C' language and doing a relative path
so I tried this xml = loadXMLDoc(\\..\\..\\books.xml"); which located the file in the root of the C; drive.
GMann
Member
406 Points
519 Posts
Help can't seem to get location path syntax correct
Nov 09, 2012 07:06 PM|LINK
Hi:
I am trying to read an xml file located at c:\books.xml like so
xml = loadXMLDoc("c:/books.xml");
The code can't seem to find it ?
function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET", dname, false); xhttp.send(""); return xhttp.responseXML;} I am getting Jscript error when I try and open my file with : xhttp.open("GET", dname, false);Thanks for your help
madflatpicke...
Member
301 Points
67 Posts
Re: Help can't seem to get location path syntax correct
Nov 09, 2012 08:27 PM|LINK
The open method, you are calling as xhttp.open() is used to request data from a URL on a server.
You are attempting to open a local file. That is invalid.
Gaspard
Contributor
2066 Points
416 Posts
Re: Help can't seem to get location path syntax correct
Nov 09, 2012 09:57 PM|LINK
This link may help
http://social.msdn.microsoft.com/Forums/en/netfxjscript/thread/29a2f351-5bb2-4edd-ac19-c2e4d3b6f4d0
Regards
GMann
Member
406 Points
519 Posts
Re: Help can't seem to get location path syntax correct
Nov 10, 2012 02:02 AM|LINK
Thanks
GMann
Member
406 Points
519 Posts
Re: Help can't seem to get location path syntax correct
Nov 10, 2012 02:05 AM|LINK
Thanks;
I found the answer, i ran across some windows documentation which memtioned the 'C' language and doing a relative path
so I tried this xml = loadXMLDoc(\\..\\..\\books.xml"); which located the file in the root of the C; drive.