My application in C # receives the indented xml. I need to leave this xml all in a single line. How can I do this?
My application in C # receives the indented xml. I need to leave this xml all in a single line. How can I do this?
If you get xml for a file:
XDocument document = XDocument.Load("arquivo.xml");
document.Save("arquivo2.xml", SaveOptions.DisableFormatting);
Or if you have xml in a string:
XDocument document = XDocument.Parse(stringXML);
document.Save("arquivo.xml", SaveOptions.DisableFormatting);
You can separate the rows into array and then concatenate
string xml = dadosdoxml.ToString();
var separar = xml.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
string final = string.Join(" ", separar );