using jquery to parse XML export in drupal

Posted by gables20 on Stack Overflow See other posts from Stack Overflow or by gables20
Published on 2011-03-08T15:17:16Z Indexed on 2011/03/08 16:10 UTC
Read the original article Hit count: 226

Filed under:
|
|
|
|

I need to use jquery to parse a drupal xml export that was created with views datasource module. The format of the xml export is shown below and on the browser, its access by entering, say for example, http://mydomain/test.xml, where test.xml represents the path of the xml export.

 <node> 
     <node> 
         <nothing>
            Lorem ipsum 
        </nothing>
      </node>
<node> 

The jquery to parse xml is shown below. But, it does nothing, which is kind of the main problem.

$(document).ready(function(){ 
    $.ajax({
        type: "GET", 
        url: "http://mydomain/test.xml",
        dataType: "xml", 
        success: function(xml){ 
            $(xml).find('node').each(function(){ 
                var title = $(this).find('nothing').text();  
             $('#output').append($(this).find('nothing').text());           
            });
        }
    });
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about Xml