Changeset 7559 for cows_wps


Ignore:
Timestamp:
30/09/10 23:34:45 (9 years ago)
Author:
astephen
Message:

Fixed bug in extractFromXML so it now follows path correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/public/js/ui/utils.js

    r7539 r7559  
    126126} 
    127127 
     128/* 
     129THIS WORKS: 
     130$(global_xml).find("ExecuteResponse").each(function() { 
     131a = $(this); 
     132}); 
     133$(a).find("Status").each(function() { 
     134b = $(this); 
     135}); 
     136$(b).find("ProcessSucceeded").each(function() { 
     137c = $(this).text(); 
     138}); 
     139alert(c); 
     140*/ 
     141 
     142var global_xml = null; 
    128143function extractFromXML(xml, xml_path) { 
    129144        // Extracts values at xml_path location within XML response 
    130145        // E.g. <person><job>nurse mother</job></person> and "person/job" will resturn ["nurse", "mother"] 
     146global_xml = xml; 
    131147        var parts = xml_path.split("\/"); 
    132148        var item = parts.shift(); 
    133149        var new_path = parts.join("/"); 
    134150 
    135         var resp = false; 
    136  
    137151        $(xml).find(item).each(function() { 
    138                 if (parts.length == 0) { 
     152                if (new_path === "") { 
    139153                        resp = $(this).text(); 
    140154                        // This return is for the embedded function and not the object method 
    141                         return; 
     155                        return resp; 
    142156                } else { 
    143157                        return extractFromXML($(this), new_path); 
     
    145159        }); 
    146160 
    147         if (resp) return resp; 
     161        return resp; 
    148162} 
    149163 
Note: See TracChangeset for help on using the changeset viewer.