Validate XML with XSD using Visual Studio 2010

Asslamualaykum wr br…today we elaborate the way to validate XML against XSD (Xml Schema Defination).

Before we go into this, Let me first clarify the necessity of it. We use XML to transfer information(which can be data as well) from one application to other application as per the system Architecture. The reason for XML to be chosen is that XML is a platform independent language, so the information formatted in XML can be used in any other platforms (Operating Systems). Once we create an XML file in one platform it can be used in other platforms also.

The sample XML File which is input to the system is shown below as

Xml input is given as:


XSD to validate the XML is given as:




When i change the xml field like assigning null as Customer Id then the output would be: