Mega Code Archive
XmlReader ReadElementContentAsBase64 Method reads the element and decodes the Base64 content
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim buffer(999) As Byte
Dim readBytes As Integer = 0
Using reader As XmlReader = XmlReader.Create("output.xml")
Dim outputFile As New FileStream("C:\newImage.jpg", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)
reader.ReadToFollowing("image")
Dim bw As New BinaryWriter(outputFile)
readBytes = reader.ReadElementContentAsBase64(buffer, 0, 50)
While (readBytes > 0)
bw.Write(buffer, 0, readBytes)
readBytes = reader.ReadElementContentAsBase64(buffer, 0, 50)
End While
outputFile.Close()
End Using
End Sub
End Class