Hello, I try to validate a xml doc with my schema but I thing I forgot something in my code because it did not validate anything. here's my code Dim xmlFileName As String = "myXml.xml" Dim pathToXsd As String = "mySchema.xsd" Dim xSchemaColl As New XmlSchemaCollection
Dim xTReader As XmlTextReader Dim xValReader As XmlValidatingReader Dim i As Integer Dim validationEventHandler As ValidationEventHandler Try xSchemaColl.Add(Nothing, New XmlTextReader(pathToXsd)) xTReader = New XmlTextReader(xmlFileName) xValReader = New
XmlValidatingReader(xTReader) xValReader.Schemas.Add(xSchemaColl) xValReader.ValidationType = ValidationType.Schema Do While (xValReader.Read()) Loop xTReader.Close() xValReader.Close() Catch ex As Exception xTReader.Close() xValReader.Close() End Try If I
change my xml file and put bad information, this code doesn't throw any exception, ...
dev.null
Member
5 Points
1 Post
Xml validation problem
Apr 26, 2004 09:48 AM|LINK