I need to generate xml
, however without jumping line, the way I generate it is all indented, how do I save without skipping line?
document.LoadXml(soapEnvelope);
document.Save(@"E:\nota.xml");
I tried this code below:
XDocument document = XDocument.Load("arquivo.xml");
document.Save("arquivo2.xml", SaveOptions.DisableFormatting);
However, the option SaveOptions
does not appear, I use ASP.NET CORE
.
This is the whole method:
private void montaEnvelope(HttpWebRequest webRequest, XmlDocument document)
{
string soapEnvelope = string.Empty;
soapEnvelope += "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.issweb.fiorilli.com.br/\" xmlns:xd=\"http://www.w3.org/2000/09/xmldsig#\">";
soapEnvelope += "<soapenv:Header/><soapenv:Body><ws:gerarNfse>";
soapEnvelope += document.LastChild.OuterXml.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", string.Empty);
soapEnvelope += "<username>01001001000113</username><password>123456</password></ws:gerarNfse></soapenv:Body></soapenv:Envelope>";
MemoryStream stream = stringToStream(soapEnvelope);
webRequest.ContentLength = stream.Length;
Stream requestStream = webRequest.GetRequestStream();
stream.WriteTo(requestStream);
document.LoadXml(soapEnvelope);
document.Save(@"E:\nota.xml");
XDocument document1 = XDocument.Load(@"E:\nota.xml");
this.XmlDocNFSe = document;
}