View Full Version : Parsing response.responseXML in a browser-independent way

31 Oct 2006, 11:35 AM
I am using YAHOO.util.Connect.asyncRequest method and get response with the following response.responseText value:

<?xml version="1.0" encoding="UTF-8"?>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" >
<param name="allowScriptAccess" value="sameDomain" />
</data>How can I retrieve the following part of xml

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" >
<param name="allowScriptAccess" value="sameDomain" />
</object>in a browser-independent way?

response.responseXML.text works fine in IE and Opera, but doesn't work in FF
response.responseXML.documentElement.textContent works fine in FF and Opera but doesn't work in IE

Is there a way to parse response.responseXML in a browser-independent way?

31 Oct 2006, 2:43 PM
You could try:


Obviously not ideal but it should work.

31 Oct 2006, 4:32 PM

var s ='';
if (result.responseXML.xml)
s = result.responseXML.xml; // IE
s = (new XMLSerializer()).serializeToString(result.responseXML); // Mozilla

not sure if the Mozilla way works in Safari too

17 Feb 2012, 6:37 AM
Thank You Jack ! Your post helped me :)
I'm using Sencha Touch 2 Beta 2 and not sure which functions can be used with it and which can not.
- Sachin Warke