The XMLSchema-instance Namespace

Welcome to our free XML Schema tutorial. This tutorial is based on Webucator's Introduction to XML Schema course.

Contact Us or call 1-877-932-8228
The XMLSchema-instance Namespace

The XMLSchema-instance Namespace

The XMLSchema-instance namespace contains only four attributes. Here is a simplified version of the schema.

Code Sample:

Namespaces/Demos/XMLSchema-instance.xsd
<?xml version='1.0'?>
<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:attribute name="nil"/>
 <xs:attribute name="type"/>
 <xs:attribute name="schemaLocation"/>
 <xs:attribute name="noNamespaceSchemaLocation"/>
</xs:schema>

By specifying that an XML document uses the XMLSchema-instance namespace, the instance author gets access to the four attributes declared above. We have already seen three of these attributes used.

  • xsi:nil is used to specify that an element has no value. It is covered in Nil Values.
  • xsi:schemaLocation is used to specify the location of a schema for a particular namespace.
  • xsi:noNamespaceSchemaLocation is used to specify the location of a schema when no namespace is used.
  • xsi:type is infrequently used to specify that the element in the instance is of a different type than the one declared in the schema for that element.
Next

This tutorial is based on Webucator's Introduction to XML Schema Course. We also offer many other XML Training courses. Sign up today to get help from a live instructor.