XSD Schema, DTD and Relax NG are three common ways to
validate a XML file structure. The first approach, XSD Schema, has been
supported by Microsoft .NET Framework and is the best approach for .NET
developers. Schema files are a special kind of XML file that define the
structure of an XML file via some pre-defined elements and attributes.
Using this Schema file you can validate your XML file to
make sure it fits to your application's needs to prevent any exception in your
code. There are several free or commercial tools which do this validation for
you, but in many cases you need to accomplish this task in your own
applications with your code.
Fortunately, .NET has provided all the tools to do this and
all you need is to apply these tools. The process to do this is a bit
different in .NET 2.0 because a main object for this process in .NET 1.x is
obsolete in .NET 2.0.
Here I give you the steps you need to do this in both .NET
1.x and 2.0.