I am trying to convert the below xml
<variants>
<item>
<name>sport</name>
<description>sport desc</description>
<item-values>
<item-value>
<item>ball</item>
<value>stichball</value>
</item-value>
</item-values>
</item>
</variants>
to xml like below as the nodes splitted to key value pair
<variants>
<item name="sport" description="sport desc">
<item-values>
<item-value item="ball" value="stichball"/>
</item-values>
</item>
</variants>
Is it possible to make this in a generic way