SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can i parse a remote xml file with javascript?

    I'm using this method to parse my XML file:

    xmlDoc = document.implementation.createDocument("","channel",null);
    xmlDoc.async=false;
    var url="http://www.noslang.com/newslang.xml";
    xmlDoc.load(url);

    It works great locally... but if i try to parse it remotely, i can't :'(

    I'm trying to write a firefox extension that has access to this XML... so it's gotta be JS

    Is there a way I can parse a remote XML file using javascript?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    parse remote xml file

    You may want to use XMLHttpRequest or Sarissa

  3. #3
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague
    You may want to use XMLHttpRequest or Sarissa
    XMLHttpRequest cannot request remote files, unfortunately.

    To the best of my knowledge, you need a server side script (that basically just goes <?php echo file_get_contents($_GET['url']); ?> sort of thing).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •