Extensions Class contains the LINQ to XML extension methods for XSD validation. : XmlSchemaSet « XML « VB.Net






Extensions Class contains the LINQ to XML extension methods for XSD validation.

  

Imports System
Imports System.Xml
Imports System.Xml.Schema


Imports System.Xml.XPath

Public Class MainClass
    Private Shared Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs)
        Console.WriteLine("{0}", e.Message)
    End Sub

    Public Shared Sub Main()
        Dim schemas As XmlSchemaSet = New XmlSchemaSet()
        schemas.Add("", "data.xsd")

        Dim custOrd As XDocument = XDocument.Load("data.xml")
        custOrd.Validate(schemas, AddressOf XSDErrors)

    End Sub
End Class

   
    
  








Related examples in the same category