Q:

How to format the given xml into single line (without spaces)

Using C# how can i format a given xml file into a single single line (without spaces)? 
My output is giving symbols if there are spaces and new lines.

A:

Use this:
public static string StripXmlWhitespace(string Xml)
{
    Regex Parser = new Regex(@">\s*<");
    Xml = Parser.Replace(Xml, "><");

    return Xml.Trim();
}

