A XML Schema can be referenced from an XML document by defining the schemaLocation and noNamespaceSchemaLocation attributes.
The 'schemaLocation' attribute is used to reference XML Schema(s) that are defined in a target-namespace.
<root xmlns="http://www.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org example.xsd">
The schemaLocation attribute can contain a list of namespaces and schema-locations, separated by white-space.
You can define multiple namespaces/schema-location pairs to validate elements and attributes in different namespaces.
<root xmlns="http://www.example.org" xmlns:ns2="http://www.example2.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org example.xsd http://www.example2.com example2.xsd">
The 'noNamespaceSchemaLocation' attribute is used to reference XML Schema(s) that are not defined in a target-namespace.
<root xmlns="http://www.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="example.xsd">
The noNamespaceSchemaLocation attribute only contains schema-locations and no namespace-uris.
The schemaLocation/noNamespaceSchemaLocation attributes are in is the 'http://www.w3.org/2001/XMLSchema-instance' namespace.
The schemaLocation/noNamespaceSchemaLocation attributes are provided as a hint for the XML Processor (the XML Processor is not obliged to use it).