I've got an XSD
which I've turned into classes using the VS XSD.exe
The code will populate these classes before getting to a stage when I then want to validate that they are "correctly" populated - for example, if a field is mandatory in the XSD, but it is a string object in the generated class, will anything stop me from leaving it blank? - if nothing stops me it will be invalid! (Something like this question)
I'm trying to avoid generating my XML
and then reading it back in and validating the actual XML
against the XSD
if this is at all possible. I want to know that the population of the classes has been done wrong before I even attempt to generate the XML
.
Any thoughts or examples would be great!
There are lots of articles about validating XML
against an XSD
but I can't find anything helpful about validating the population of the generated classes against an XSD
. I don't know if this is possible!