Applying a Schema

To attach a schema to a document you must do the following:

For the first item in this program, add the following attribute to the document's root element:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

The namespace prefix xsi is commonly used for the XML schema instances. The syntax to specify the location of the schema document depends on whether the instance document (the one that is specified by the XML schema) has been placed in a namespace. If there is no namespace for the contents of the instance document, add the following attribute to the root element:

xsi:noNamespaceSchemaLocation="schema_file.xsd"