|
Below is some VB.NET code which I am trying to test the "CoreFilingMessage.xml" against it's XSD. I am getting a System.Xml.XmlSchemaValidationException which is stating "All schemas in the set should be successfully preprocessed prior to compilation." Any ideas? Also still interested in seeing anyone's sample data sets.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
mytest(displayXMLDoc, "C:\ecf\ECF-3.1-CoreFilingMessage.xsd")
End Sub
' based on URL: http://www.vbforums.com/showthread.php?t=528172
Sub mytest(ByVal myDocument As XmlDocument, ByVal schema As String)
'myDocument.Schemas.Add("namespace here or empty string", "C:\someschema.xsd")
myDocument.Schemas.Add("urn:oasis:names:tc:legalxml-courtfiling:schema:xsd:CoreFilingMessage-3.1", schema)
Dim eventHandler As ValidationEventHandler = New ValidationEventHandler(AddressOf ValidationEventHandler)
Try
myDocument.Validate(eventHandler)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub ValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)
Select Case e.Severity
Case XmlSeverityType.Error
Debug.WriteLine("Error: {0}", e.Message)
Case XmlSeverityType.Warning
Debug.WriteLine("Warning {0}", e.Message)
End Select
End Sub
|