How to Display Formatted XML

asp.net-mvc, xml

Solution

Simply load the XML into an `XElement`, then use `XElement.ToString()`.

Problem

I have xml data that I am returning to my view. I am putting it in a textarea, but this displays it unformatted. How can I format the xml for display in my view? I will be displaying the xml in only part of the page, so I can't let IE display it. I want it to be in standard xml indented format.

Original source