XML Schemas are a major upgrade from DTDs that provide an excellent way to validate an XML document’s structure as well as its content. Although many tools including VS.NET and XML Spy can create schemas, what tools can be used to programmatically manipulate an existing schema in .NET? The answer to this question lies in the System.Xml.Schema namespace. Classes within this namespace allow schemas to be created from scratch or modified.
This sample application demonstrates how to modify an XML schema using the XmlSchema and supporting classes found in the System.Xml.Schema namespace to create a simpleType facet for an element named ShippedDate. After running the sample, you will see the modifications in the Modified Schema textbox.