XML : replace xml/svg element attribute for specific element only

I have 'XML` like this,

  <text>      <tspan fill='rgba(0,0,0,0)'>abc</tspan>  </text>  <rect fill='rgba(0,0,0,0)'></rect>    

I am trying to replace rgba( with rgb(, but its replacing all instances occur in data. I just want to replace all the instances for tspan tag only. I tried str_replace but replacing all instances into data.

Output should look like this

  <text>      <tspan fill='rgba(0,0,0,0)'>abc</tspan>  </text>  <rect fill='rgb(0,0,0,0)'></rect>    

No comments:

Post a Comment