XmlReader.ReadElementContentAsBinHex Method reads the element and decodes the BinHex 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)
' Read to the image element.
reader.ReadToFollowing("image")
Dim bw As New BinaryWriter(outputFile)
readBytes = reader.ReadElementContentAsBinHex(buffer, 0, 50)
While (readBytes > 0)
bw.Write(buffer, 0, readBytes)
readBytes = reader.ReadElementContentAsBinHex(buffer, 0, 50)
End While
outputFile.Close()
End Using
End Sub
End Class
Related examples in the same category