I'm trying to convert an xml node into an object...all I want to do is
find the name of the tag...function



function initObjArray(xml, arr, tagName){
        (xml).find(tagName).each(function(){

                var o = new Object();
                var t = $(this);
                var c = t.children();
                c.each( function(){

var key = $(this).TAGNAME;
var val = $(this).text();

o[key] = val;


                        });

        });

}


So that:

<fruit>
<type>apple</type>
<color>red</color>
</fruit>

will be:

fruit.type = apple;
fruit.color = red;

Reply via email to