schemaLocation
The schemaLocation attribute references an XML Schema document that has a target namespace.
<xsi:schemaLocation="list of anyURI" >
Attributes
- anyURI (list)
The location of a schema that contains qualified (a schema with a namespace) schema constructs. The first URI reference in each pair is a namespace name, and the second is the location of a schema that describes that namespace.
Remarks
This attribute associates an XML Schema document that has a target namespace with an instance document.
An XML Schema is not required to have a namespace. To specify the location for an XML Schema that does not have a target namespace, use the noNamespaceSchemaLocation attribute. The XML Schema referenced in this attribute cannot have a target namespace. Because this attribute does not take a list of URLs, you can only specify one schema location.
Associates a schema document that have a target namespace with an instance document. Multiple pairs of URI references can be listed, each with a different namespace name part.
According to the World Wide Web Consortium (W3C) XML Schema Recommendation, XML instance documents can have both xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes specified. In addition, you can list the same namespace several times.
In MSXML 6.0, if you have specified a xsi:schemaLocation and processed an element from that namespace, you can't specify a new xsi:schemaLocation. MSXML 6.0 reports an error for this situation. Previous versions reported no error.
Example
The following example shows the use of xsi:schemaLocation attribute that provides location information for several XML Schema documents.
<p:Person
xmlns:p="https://contoso.com/People"
xmlns:v="https://contoso.com /Vehicles"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"https://contoso.com/People
https://contoso.com/schemas/people.xsd
https://contoso.com/schemas/Vehicles
https://contoso.com/schemas/vehicles.xsd
https://contoso.com/schemas/People
https://contoso.com/schemas/people.xsd">
<name>John</name>
<age>28</age>
<height>59</height>
<v:Vehicle>
<color>Red</color>
<wheels>4</wheels>
<seats>2</seats>
</v:Vehicle>
</p:Person>
See Also
Reference
XML Schemas (XSD) Reference
XML Schema Elements
XML Schema Instance Attributes
noNamespaceSchemaLocation