XML Parsing Help Needed

Asky

Well-Known Member
Adept
May 24, 2005
348
5
81
32
Hi , I am trying to parse an XML file and display the contents in an HTML Table.

I've been able to parse the contents and display the data ( as i want) using Javascript but i'm facing a problem.

This only works if the XML file is local.

I want to parse a XML file stored on a website like http://www.test.com/file.xml

Can i do this using Javascript ( if not what do i use to parse the data) ?

xmlDoc.load('ClassVisit.xml'); // Works

xmlDoc.load('http://www.website.com/ClassVisit.xml');

//Doesnt Work

Please let me know.

Thanks.
 

YoGi-Sama

Well-Known Member
Adept
Jul 14, 2007
2,203
151
152
39
City of Blinding Lights
yogi.eyeris.in
If you're testing locally, it won't work as Flash player security won't allow. For that you need to go to Adobe - Flash Player : Settings Manager - Global security settings for content creators, and set location of your SWF file as safe list to be able to access non-local content.

Secondly, if you're embedding the file in HTML and viewing it, you need to host the file on web-server and set allowScriptAccess parameter to Always to be able to access cross-domain content.
 

Asky

Well-Known Member
Adept
May 24, 2005
348
5
81
32
Thanks for the help guys.

Yep Javascript wudnt allow getting the XML file from a different domain.

I had to use PHP to make it work.