Currently, I am using JavaScript to manipulate XML without involving the DOM in a browser context. I need assistance with creating an E4X expression that can rename a list of tags based on a given substring. The challenge is that I may not know the exact tag names beforehand.
Here is a hypothetical scenario:
someXML = <Favourites>
<JillFaveColour>Blue</JillFaveColour>
<JillFaveCandy>Smarties</JillFaveCandy>
<JillFaveFlower>Rose</JillFaveFlower>
<Favourites>
My objective is to transform the XML into:
<Favourites>
<GaryFaveColour>Blue</GaryFaveColour>
<GaryFaveCandy>Smarties</GaryFaveCandy>
<GaryFaveFlower>Rose</GaryFaveFlower>
<Favourites>
The catch is that the number of tags can vary and their full names are unknown. They should only be renamed if they contain a specific substring (in this case, "Jill").