Write Line("doc1 ", IIf(errors = True, "did not validate", "validated")) Console. Write Line("Validating doc2") Dim xrs As New Xml Reader Settings() xrs.
Create Reader() Using xr2 As Xml Reader = Xml Reader.
This is not a complete solution, but this might help you get to where you want to be.
Validate(this XElement source, Xml Schema Object partial Validation Type, Xml Schema Set schemas, Validation Event Handler validation Event Handler) void Extensions. Write Line("doc2 ", IIf(errors = True, "did not validate", "validated")) End Sub Output: Validating doc1 The element 'Root' in namespace ' has invalid child element 'Child1' in namespace ' doc1 did not validate Validating doc2 doc2 validated elements are in no namespace. Schema Module Module1 Dim errors As Boolean = False Private Sub XSDErrors(By Val o As Object, By Val e As Validation Event Args) Console. Message) errors = True End Sub Private Function Add Name Space(By Val x Doc As XDocument, By Val ns As XNamespace) As XDocument For Each element As XElement In x Doc. Local Name Next Return x Doc End Function Sub Main() Dim xsd Markup As XElement = _ Dim ns As XNamespace = " doc1 = Add Name Space(doc1, ns) Console. The 'Grand Child3' element is invalid - The value 'ZZZ' is invalid according to its datatype 'GCType' - The Enumeration constraint failed.
The ' DOB' element is invalid - The value '1999-0dsf2-21' is invalid according to its datatype ' - The string '1999-0dsf2-21' is not a valid Xsd Date Time value.I resolved that in the same manner as in the question i linked originally....
93 Comments