The illustration validates an XML document that the user chooses, either or catelog1against the XML Schema document
You need one schema and two XML files to validate against the schema.
schemavalidate]: Element Your Root Element Name : No matching global declaration available for the validation root. Load(reader) Dim event Handler As Validation Event Handler = New Validation Event Handler(Address Of Validation Event Handler) ' the following call to Validate succeeds. If you want someone else to be notified, you need to put the @ sign followed by their name. The reason the validation is not working is because you are adding the schema validation to the reader, but then you attach the and validation event handler that they use to perform the the validation. Create(xml File Path, settings) ' Read the document... Create(xml File Path, settings) Dim document As Xml Document = New Xml Document() document. Warning 'Messagebox(e, "error") End Select End Sub You will receive notifications whenever any comment is added to your own question, but others like @sandy and I will not. It will work to use both, as you have done, but it does introduce some unnecessary confusion. Validation Event Handler, New Validation Event Handler(Address Of Validation Event Handler) Dim reader As Xml Reader = Xml Reader. I am using Xml Reader Setting and trying to follow an example on MSDN but not able to make it work. You have given half of what they need to each of them instead of all of what they need to one or the other. Thanks for your answer Steven, it is really good .. so if I set event Handler to XMLReader Settings, do I still do document. Do I still need to set event Handler to Document as well?It doesn't validate the xml even I throw a totally different file against schema. Thanks, Protected Sub Validate XML(xml File Path As String, schemas File Path As String) Try Dim settings As Xml Reader Settings = New Xml Reader Settings() settings. In other words, you have done the following: Dim settings As Xml Reader Settings = New Xml Reader Settings() settings. Protected Sub Validation Event Handler(By Val sender As Object, By Val e As Validation Event Args) Select Case e. Error 'Messagebox(e, "error") Case Xml Severity Type.