I would like to solve the following problem using LINQ to XML, if possible. Using LINQ to XML might not be the suitable way to solve a problem like this? If not, what is the best technique to use? All elements like this:
<Name>XXX</Name>
sholud be replaced with:
<Attribute name="Name">XXX</Attribute>
in the following XML?
<Object type="SignalGroup">
<Name>General</Name>
<Object type="Signal">
<Name>Input</Name>
<Attribute name="Description">This is a public object.</Attribute>
</Object>
<Object type="Signal">
<Name>PublicName</Name>
<Attribute name="ToolTitle">Public name</Attribute>
<Attribute name="Description">This is a public object.</Attribute>
</Object>
</Object>
The desired result is:
<Object type="SignalGroup">
<Attribute name="Name">General</Attribute>
<Object type="Signal">
<Attribute name="Name">Input</Attribute>
<Attribute name="Description">This is a public object.</Attribute>
</Object>
<Object type="Signal">
<Attribute name="Name">PublicName</Attribute>
<Attribute name="ToolTitle">Public name</Attribute>
<Attribute name="Description">This is a public object.</Attribute>
</Object>
</Object>