I have an XML as below. In this XML all the attributes are available as elements.
<Dress>
<ID>001</ID>
<shirts>
<product>
<ID>345</ID>
<Name>tee</Name>
<Serial>5678</Serial>
</product>
<product>
<ID>456</ID>
<Name>crew</Name>
<Serial>4566</Serial>
</product>
</shirts>
<pants>
<product>
<ID>123</ID>
<Name>jeans</Name>
<Serial>1234</Serial>
<Color>blue</Color>
</product>
<product>
<ID>137</ID>
<Name>skirt</Name>
<Serial>3455</Serial>
<Color>black</Color>
</product>
</pants>
</Dress>
I need convert this XML as:
<Dress ID="001">
<shirts>
<product ID="345" Name="tee" Serial="5678"/>
<product ID="456" Name="crew" Serial="4566"/>
</shirts>
<pants>
<product ID="123" Name="jeans" Serial="1243" Color="blue"/>
<product ID="123" Name="skirt" Serial="3455" Color="black"/>
</pants>
</Dress>
Basically I need to convert the elements to attributes. How do I do this using c#?
