|
-
Jul 12th, 2007, 10:06 AM
#1
Thread Starter
Hyperactive Member
Last edited by singularis; Jul 12th, 2007 at 10:09 AM.
-
Jul 15th, 2007, 06:52 PM
#2
Re: XSD: How do schemas point out errors?
But it isn't valid. Check this out:
http://tools.decisionsoft.com/schemaValidate/
cvc-complex-type.2.4.a: Invalid content was found starting with element 'bad'. One of '{"":nickname}' is expected.
-
Jul 16th, 2007, 10:00 AM
#3
Thread Starter
Hyperactive Member
Re: XSD: How do schemas point out errors?
So you would need an XML validator....
That answers a few questions
-
Jul 16th, 2007, 10:44 AM
#4
Re: XSD: How do schemas point out errors?
I don't have the full version of VS so I'm not sure if there is some "automatically validate against schema" setting in the IDE when you create an XML file maybe?
Anyway, so for validation, you can do something like this perhaps:
vb.net Code:
' Check my Xml.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Setup the settings.
Dim rdrSets As New XmlReaderSettings()
With rdrSets
.ValidationType = ValidationType.Schema
.ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema Or _
XmlSchemaValidationFlags.ProcessSchemaLocation Or _
XmlSchemaValidationFlags.ReportValidationWarnings
End With
' Validation event handler.
AddHandler rdrSets.ValidationEventHandler, AddressOf ValidateXML
Dim rdr As XmlReader = XmlReader.Create("C:\simple.xml", rdrSets)
' Read the XML file.
Do While rdr.Read()
Loop
End Sub
Private Sub ValidateXML(ByVal sender As Object, ByVal e As ValidationEventArgs)
' <bad> is not a good node.
MessageBox.Show("Error in validation: " & e.Message)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|