Read binary hex value : XmlTextReader « XML « VB.Net






Read binary hex value

  

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 binhexlen As Integer = 0
         Dim binhex(1000) As Byte
         binhexlen = reader.ReadBinHex(binhex, 0, 50)
         Do
            binhexlen = reader.ReadBinHex(binhex, 0, 50)
            For i = 0 To binhexlen - 1
               Console.Write(binhex(i))
            Next i
         Loop While (reader.Name = "BinHex") 
   End Sub 'Main 
End Class 

   
    
  








Related examples in the same category

1.Create XmlTextReader class with the specified file.
2.Create XmlTextReader class with the specified TextReader.
3.XmlTextReader.AttributeCount gets the number of attributes on the current node.
4.XmlTextReader.BaseURI Property gets the base URI of the current node.
5.XmlTextReader.Depth Property gets the depth of the current node in the XML document.
6.XmlTextReader.GetAttribute gets the value of the attribute with the specified name.
7.XmlTextReader.GetRemainder gets the remainder of the buffered XML.
8.XmlTextReader.HasValue tells whether the current node can have a Value other than String.Empty.
9.XmlTextReader.IsEmptyElement tells whether the current node is an empty element (for example, ).
10.XmlTextReader.LinePosition Property gets the current line position.
11.XmlTextReader.LocalName Property gets the local name of the current node.
12.XmlTextReader.MoveToFirstAttribute Method moves to the first attribute.
13.XmlTextReader.Name Property gets the qualified name of the current node.
14.XmlTextReader.Normalization Property tells whether to normalize white space and attribute values.
15.XmlTextReader.ReadBase64 Method decodes Base64 and returns the decoded binary bytes.
16.XmlTextReader.XmlLang Property gets the current xml:lang scope.
17.XmlTextReader.XmlSpace Property gets the current xml:space scope.