XML Schemas help you control what elements appear in your XML documents. Similar to Document Type Definitions, they offer distinct advantages over the older syntax. Dan Wellman provides a basic overview, with examples to get you started working on your own.
An Introduction to XML Schemas - Validating a Document (Page 6 of 7 )
Now that you have your schema document, if you want to use it to validate a document, you have to link it to one. Open the document it is to be used with, in this case news.xml and add the following code to the root element:
To use the location reference above, the XSD file needs to be in the same directory as the XML file. If the documents are in different directories, you’ll need to use the full path, with double forward slashes to properly escape the slash characters.
Now save the XML document and open it in a browser; the document should load as normal in IE. To use IE to actually validate the XML document using the schema, you may need to change some of the settings of IE or download an additional plug-in; see the MSDN site for further information. As Schema documents are for use mainly in XML applications, if you want to use the schema to validate a document for your own purposes, it is best to visit an on-line validator that uses the schema to validate your XML document. An excellent on-line validator can be found at the following location: