1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    36
    Vote Rating
    0
    kovtik is on a distinguished road

      0  

    Default Parsing response.responseXML in a browser-independent way

    Parsing response.responseXML in a browser-independent way


    I am using YAHOO.util.Connect.asyncRequest method and get response with the following response.responseText value:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <data>
    <![CDATA[
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" >
    <param name="allowScriptAccess" value="sameDomain" />
    </object>
    ]]>
    </data>
    How can I retrieve the following part of xml
    Code:
    <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?

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    You could try:

    response.responseXML.getElementsByTagName('data')[0].firstChild.nodeValue;

    Obviously not ideal but it should work.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    or
    Code:
    var s ='';
    if (result.responseXML.xml)
     s = result.responseXML.xml; // IE
    else
     s = (new XMLSerializer()).serializeToString(result.responseXML); // Mozilla
    not sure if the Mozilla way works in Safari too

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    13
    Vote Rating
    0
    warkesm is on a distinguished road

      0  

    Default


    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

Similar Threads

  1. Wrong charset when reading response from POST...
    By gizzmo in forum Ext 1.x: Help & Discussion
    Replies: 20
    Last Post: 28 Aug 2007, 8:11 AM
  2. Will Ext 1.0 be independent from YUI?
    By schmidetzki in forum Community Discussion
    Replies: 1
    Last Post: 12 Feb 2007, 2:22 PM
  3. Layout urgent response needed !!!!!!!
    By stalin in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 12 Feb 2007, 6:33 AM
  4. PHP response
    By zquirm in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 11 Nov 2006, 3:02 AM

Thread Participants: 3