I must write an xml file and convert in base64.
I create the file but if i convert the results in base64 and i decode from base64 to text i have a blank line before the last. why ?
This is the code :
Dim utf8WithoutBom As New System.Text.UTF8Encoding(False)
Dim fs As New FileStream(_percorso, FileMode.Create, FileAccess.Write)
Dim XML_wr As New XmlTextWriter(fs, utf8WithoutBom) With {.Formatting = Formatting.Indented}
Dim crlf = Encoding.Unicode.GetBytes(vbCrLf)
XML_wr.Formatting = Formatting.Indented
XML_wr.Indentation = 7
XML_wr.WriteStartDocument()
XML_wr.WriteStartElement("DespatchAdvice")
XML_wr.WriteAttributeString("xmlns", "urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2")
XML_wr.Flush()
fs.Write(crlf, 0, 1)
XML_wr.WriteAttributeString("xmlns:cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")
XML_wr.Flush()
fs.Write(crlf, 0, 1)
XML_wr.WriteAttributeString("xmlns:cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
XML_wr.Flush()
XML_wr.WriteStartElement("cbc:CustomizationID")
XML_wr.WriteString("urn:fdc:peppol.eu:poacc:trns:despatch_advice:3:extended:urn:www.agid.gov.it:trns:ddt:3.1")
XML_wr.WriteEndElement()
XML_wr.Flush()
In some examples I find .write with just a parameter but i’m using framework 4.8 and my write has 3 parameters.
4