javascript - Is it possible to modify xml with the jquery xml parser? -


i have xml file contains attribute called "transform".

example :

<xml> <g transform="translate(50,20)">  <g class="x axis" transform="translate(0,150)">  </g> </g> 

need text in transform attribute translate(50,20) string variable

i can't find example jquery xml parser can work i'm not sure if possible?

my code @ minute follows :

 xmldoc = $.parsexml(xmlstring ),      $xml = $( xmldoc ),      $title = $xml.find( 'g[transform]' ).each(function(i,j)                 {                                $(j).each(function(i,j){                         var id = $(this).attr("transform");                                 console.log(id)                         });          }); 

this finds element , prints i'm not sure how modify it

as @adeneo suggested in comment, have pass-in valid xml:

<xml>   <g transform="translate(50,20)">     <g class="x axis" transform="translate(0,150)">       excluded     </g>   </g> </xml> 

see working here: http://jsfiddle.net/baatq/.


Comments