Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: What XMLHttpRequest.responseXML good for (in XHTML)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What XMLHttpRequest.responseXML good for (in XHTML)?



Hi Andrei,

You need to check that responseXML is not empty.  If the MIME type of the
response is not text/xml then the content will be in responseText.

HTH.

Regards,

John Jameson.


Message: 2
Date: Wed, 4 Oct 2006 19:53:01 -0400
From: Andrei Tchijov <email@hidden>
Subject: What XMLHttpRequest.responseXML good for (in XHTML)?
To: Apple Web Dev list <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I am using some AJAX (via prototype.js ) to get content of XHTML
file.  AJAX works perfectly. I am getting wonderful XML which looks/
sounds/smells like DOM XML representing my XHTML page. The problem it
that every time I am trying to "move" nodes from XML which I got via
AJAX to my XHTML page DOM, Safari crash.  These are relevant bits of
my code:

...
function importXHTML( url ) {
    var myAjax = new Ajax.Request( url, { method: 'get', asynchronous:
false });
    if( myAjax.transport.status != 200 ) {
        return null;
    }
    return myAjax.transport.responseXML;
}
...
var xhtml = importXHTML( fullHref );

var bodyElement = xhtml.documentElement.getElementsByTagName( "body" )
[0];
var nextChild = bodyElement.firstChild;

while( nextChild ) {
    target.appendChild( nextChild );
    nextChild = nextChild.nextSibling;
}
...

To be precise, Safari crash trying to "appendChild" first element
node (the very first node happen to be #text and it does not case any
problems ).

Am I doing something illegal?  The very same code works happily on
Firefox.

Your comments will be highly appreciated,

Andrei Tchijov
Leaping Bytes, LLC

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.