Reputation: 3482
Is it possible to validate XML against a Serializable class rather than and XSD?
I would rather do this as my business layer has a reference to the class whereas if I was to validate the XSD I would have to Create a XmlSchemaSet and pass a reference through.
If not what is the best solution for validating the XML bearing in mind performance is an issue as this will happen every call on the service I am writing?
Upvotes: 1
Views: 1403
Reputation: 33272
Try to deserialize the xml as the class you are expecting it represents. If it works without exception it is valid.
Upvotes: 1