I have been trying to use the XElement, as advised by John Saunders. However My XML is not indented in the Razor View. I must be doing something silly, but I cannot see it.
Controller Code:
XElement myXElement = XElement.Load(strMapPath + strFileName);
ViewBag.MyOrigDocXML = myXElement;
return View();
Razor Code in View:
@if(ViewBag.MyOrigDocXML != null)
{
@ViewBag.MyOrigDocXML.ToString();
}
Any help greatly appreciated,
I would nest your code inside pre html tags like
this will then give you your xml in an indented layout, then add prettify to get xml text highlighted