XmlTextReader.ReadBase64 Method decodes Base64 and returns the decoded binary bytes.
Option Explicit
Option Strict
Imports System
Imports System.IO
Imports System.Xml
Imports Microsoft.VisualBasic
Public Class Sample
Private Const filename As String = "binary.xml"
Public Shared Sub Main()
Dim reader As XmlTextReader = Nothing
Dim i As Integer
reader = New XmlTextReader(filename)
reader.WhitespaceHandling = WhitespaceHandling.None
While reader.Read()
If "Base64" = reader.Name Then
Exit While
End If
End While
Dim base64len As Integer = 0
Dim base64(1000) As Byte
Do
base64len = reader.ReadBase64(base64, 0, 50)
For i = 0 To base64len - 1
Console.Write(base64(i))
Next i
Loop While (reader.Name = "Base64")
End Sub 'Main
End Class 'Sample
Related examples in the same category