XML VB.Net Tutorial

Imports System
Imports System.Xml
Imports System.Xml.Schema
Class XmlSchemaSetExample
    Shared Sub Main()
        Dim booksSettings As XmlReaderSettings = New XmlReaderSettings()
        booksSettings.Schemas.Add("http://www.yourname.com/books", "books.xsd")
        booksSettings.ValidationType = ValidationType.Schema
        AddHandler booksSettings.ValidationEventHandler, New ValidationEventHandler(AddressOf booksSettingsValidationEventHandler)
        Dim books As XmlReader = XmlReader.Create("books.xml", booksSettings)
        While books.Read()
        End While
    End Sub
    Shared Sub booksSettingsValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)
        If e.Severity = XmlSeverityType.Warning Then
            Console.Write("WARNING: ")
            Console.WriteLine(e.Message)
        ElseIf e.Severity = XmlSeverityType.Error Then
            Console.Write("ERROR: ")
            Console.WriteLine(e.Message)
        End If
    End Sub
End Class
'
'  
'    A
'    
'      X
'      Y
'    

'    8.99
'  
'  
'    Java
'    
'      Q
'      Q
'    

'    11.99
'  
'  
'    C#
'    
'      Author
'    

'    9.99
'  
'
'
'The following is the schema that validates the example XML document. 
'
'
'
'    
'        
'            
'                
'                    
'                        
'                            
'                            
'                                
'                                    
'                                        
'                                        
'                                        
'                                    

'                                

'                            
'                            
'                        

'                        
'                        
'                        
'                    

'                
'            

'        

'    
'