Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Xml Load problem in Safari.

    Hi,
    I stated this problem incorrectly earlier and am revising it now.
    I having a problem loading data from an xml document into the Safari browser for the mac. The code works fine with firefox and IE.

    The problem occurs in the following block of code:


    else if (document.implementation && document.implementation.createDocument){
    xmlDoc = document.implementation.createDocument("","", null);
    xmlDoc.load(xmlFile);
    }


    I'm not exactly sure what the issue is, but it seems that the line xmlDoc = document.implementation.createDocument("","", null); craetes a Document Object in Safari rather an XMLDocument object as in Firefox. Consequently the script dies on the line xmlDoc.load(xmlFile); and I think the xml file is never loaded.

    Any ideas.
    Last edited by C_Angell; 12-19-2006 at 02:55 AM. Reason: Stated problem incorrectly on original post

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Sadly, Safari DOM support is a bit of a blind spot for me, as I haven't really played around with that browser except for confirming that things work in it.

    Does Safari support the load method on DOMDocument at all? This method was part of one of the early DOM3LS Working Drafts, but it did not make it into the DOM2LS Recommendation.

    Maybe you should try using XMLHttpRequest instead. Just a thought.


    Edit: Tarquin's support table in this article suggest neither Opera nor Safari supports the load method on DOMDocument objects. which is entirely okay by me, since those browsers support XMLHttpRequest.

    I also know Opera states support for DOM3LS, which means you can try using document.implementation. createLSParser and then use the LSParser interface in that browser.

    I do not think Safari supports that interface, however, so XMLHttpRequest is probably your best bet.
    Last edited by liorean; 12-19-2006 at 01:00 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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