I want to create dynamic XML hieararchy but still couldn't be successful about it.I tried LinqToXml classes and XML classes but still i couldn't. I want to create such a hierarchy in a loop dynamically.
Create root node
<Root></Root>
Then add child for it.
<Root>
<Biggest></Biggest>
</Root>
Then add child for last added node
<Root>
<Biggest>
<Bigger>
</Bigger>
</Biggest>
</Root>
Then go back add another
<Root>
<Biggest>
<Bigger>
</Bigger>
<Another>
</Another>
</Biggest>
</Root>
Edit: i want to give an example.
XElement root = new XElement("root");
XElement first = new XElement("first", "value");
XElement second = new XElement("second", "Value");
root.Add(first);
//now how can add second node into first ??
//I don't want to add second one into first then add it into root.