Add(Nothing, XSDfname) 'Instantiate a new validating reader. 'Add the schemas collection to the validating reader and funnel the 'Xml Text Reader through it. Validation Event Handler, _ New Validation Event Handler(Address Of Val XML) v Rdr. Add(Schemas) 'Read the XML file through the validator Dim node As Object While v Rdr. You would do this if you were reading the file 'piecemeal Dim Schemas As Xml Schema Collection = New Xml Schema Collection() Schemas. The Xml Validating Reader sits on top of the Xml Text Reader and validates each node according to a schema. Now you can validate against a DTD as well, or even make a validating reader that validates against nothing. One tab is for viewing the controls for the page and the other is for viewing the actual XML code generated by said controls. Figure 9-5 shows my Solution Explorer window after I added the new item. Once you have finished adding the elements, drag over an element from the Toolbox and drop it on your XML form. Once you do this, the rest of this element box should fill itself in for you automatically.
Click the element Config Date in the complex type control. #Region "vars" Private XMLfname As String = "Config Device.xml" Private XSDfname As String = "Config Device.xsd" Private nm Space As String = " Device.xsd" Private Enum MODE None On Line Off Line Dumb End Enum #End Region Private Sub Write XMLFile() Dim Relay Delay As Double Dim dte As Date Time Dim IP As String Dim mode As MODE Dim TZ_Offset As Decimal Dim Pword As String 'I am going to be really bad here and assume that all user-filled-in 'fields are going to convert properly dte = Convert. You then define a new variable whose type is this new structure. You can think of this as defining a structure with certain public variables. The best way to explain how an Xml Validating Reader works is to show you by example. In this section I expand on the previous example by adding schema support for the method that reads the XML file. Mine is called "Validate XML." The form is almost the same as that in the previous example, with the addition of one more major control.
I am going to show you one way to validate XML data as it is being read in.