On the third line, Compile( ) is happily compiling the empty schema you created in the first line.
On the second line, Xml Schema:: Read( ) is being called to load in the XML Schema Document contained in s Schema and _then throwing it all away_.
I hope I was able to provide most of you with a good insight on validating XML files using schemas.
I'm wondering if I need to do something extra to tell the xml which schema to use. Xml Text Reader(New String Reader(s Schema)) Dim Validation Schema As New Xml. Xml Text Reader(New String Reader(s XML)) Dim xml Validator As New Xml. The answer then, is to capture the Xml Schema returned by Read( ): Dim Validation Schema As Xml.
Xml Validating Reader(Input XMLReader) xml Validator.
Please note that this class has been marked obsolete in . Lets assume that the XML file that we wish to validate has details about orders.
Net framework 2.0 which recommends using XMLReader. Each of the Order contains the Order ID, details about the Customer, Discount percent given and the details about Products.