2
I have the following xml tag (I’ll summarize for size):
<docZip schema="procNFe_v3.10.xsd" NSU="000000000001868">H4sIAAAAAAAEAN1aWY+jyLJ+Pv..bla bla bla</docZip>
The field type is base64Binary, is a gzip file.
I’ve been over the internet looking for a way to "read" the XML and take this tag and generate the Gzip file that’s contained in it.
How do I take this tag that is in base64Binary and generate the file that is contained?
I tested with this example code but failed:
using System;
using System.Text;
public class Base64Decoder
{
public static void Main ()
{
string inputText = "This is some text.";
Console.Out.WriteLine ("Input text: {0}", inputText);
byte [] bytesToEncode = Encoding.UTF8.GetBytes (inputText);
string encodedText = Convert.ToBase64String (bytesToEncode);
Console.Out.WriteLine ("Encoded text: {0}", encodedText);
byte [] decodedBytes = Convert.FromBase64String (encodedText);
string decodedText = Encoding.UTF8.GetString (decodedBytes);
Console.Out.WriteLine ("Decoded text: {0}", decodedText);
Console.Out.Write ("Press enter to finish.");
Console.In.ReadLine ();
return;
}
}
Thanks for the help, but the generated file is empty. However, I managed it with File.Writeallbytes(@"c: home file.rar", buffer); but its answer solved my doubts.
– Robss70
Okay, Robss, it was nothing. I took the liberty of editing my reply so that other people could have access to a functional code, I think it is more "pedagogical". Hug
– Éderson C. do Nascimento
Thanks young....
– Robss70