Hi I am trying to read an xml file from outside the web-app container, It works fine when the xml file is in a directory inside the web-app container but doesnt work when I try to access it from a directory location outside web-app.
I am actually writing the XML file successfully before I try to read it, in any appropriate location in the disk.
I tried paths like c:/xmls/my1.xml, /myprojhome/xmls/my1.xml but only /myprjhome/js/my1.xml works since js directory is inside web-ap.
I am just trying to access by hardcoding the path in the code right now, like
map.setDataURL(“/myprjhome/js/my1.xml”); – this works but others dont, they give data error – not able to find file
Its a windows system I am working on right now, do I need to set the url for the map in some other way? (for eg. using file.seperator)
I am Using Fusion Maps – a flash based map chart tool which accepts data in xml format, so I import a javascript file which is FusionMaps.js , and this has all the functions like setDataURL inside it. I am doing this in the javascript to render the chart :
<script>
var map = new FusionMaps("/gra/swf/Maps/FCMap_World.swf", "Map1Id", "750", "400", "0", "0");
map.SetDataURL(URL of the dataxml);
</script>
The chart shows the map only if the URL is valid, else it shows invalid URL error, I tried to use the File protocol (File:///c:/cmls/mtxml.xml) but it doesnt work. Is it because of the Flash sandbox security model not allowing access to resources outside a domain of the swf file? since you can see that the swf file is located in some other path.. (that path is in web-app..)
Right, so after our conversation in the comments, we finally discover the cause of your problems.
You are doing this in Javascript, so it is on the client side. The client machine cannot see an arbitrary path on your computer (can you imagine the implications if it could?)
You have 2 options:
Would go with #1 unless you have very strong reasons for #2