The obvious doesn't catch the LF characters
foo.Replace(Environment.NewLine, String.Empty)
Nor does...
foo.Replace("\r\n", "").Replace("\n", "").Replace("\r", "")
The file itself is a multi line XML file. Line feed characters before the XML declaration invalidate the string.