You can set a flag on the XMLDocument:
// Create a new XML document.
XmlDocument xmlDocument = new XmlDocument();
// Format using white spaces.
xmlDocument.PreserveWhitespace = true;
// Load the XML file into the document.
xmlDocument.Load("file.xml");