Results 1 to 2 of 2

Thread: how to read xml file from safari?

  1. #1
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default how to read xml file from safari?

    i am currently using the code below from w3schools to parse a xml file and it works fine in firefox and ie, but when i try to view the site from safari, i get an error

    here is the error from safari:
    Code:
    Value undefined (result of expression xmlDoc.load) is not object.
    i am using the following code (originally from w3schools):
    Code:
    function loadXMLDoc(dname) 
    {
    try //Internet Explorer
      {
      xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
      }
    catch(e)
      {
      try //Firefox, Mozilla, Opera, etc.
        {
        xmlDoc=document.implementation.createDocument("","",null);
        }
      catch(e) {alert(e.message)}
      }
    try 
      {
      xmlDoc.async=false;
      xmlDoc.load(dname);	
      return(xmlDoc);
      }
    catch(e) {alert(e.message)}
    return(null);
    }
    i tried following the xmlhttpreq example from apple, but i couldnt get to work.

    if anyone has any advise, i'm all ears. thanks in advance.

  2. #2
    Join Date
    Dec 2008
    Location
    Nigeria
    Posts
    95
    Thanks
    3
    Thanked 8 Times in 8 Posts

    Default

    Why not use some server scripts to do the parsing? that way u can avoid browser dependency errors, i am not sure of ur favorite server language, i usually work with jscript/php/mysql/ajax, but i know that all server languages like asp, asp.net...can parse xml properly

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
  •