XML schema element
<Schema> element is the root element of every XML Schema.
<Schema> element
<Schema> element is the root element of every XML Schema:
<xs:schema>
/en.
/en.
</xs:schema>
<Schema> element may contain attributes. A schema declaration often looks something like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3write.com"
xmlns="http://www.w3write.com"
elementFormDefault="qualified">
/en.
/en.
</xs:schema>
The following code fragment:
Used in display schema elements and data types from the namespace "http://www.w3.org/2001/XMLSchema". It also sets out from the namespace "http://www.w3.org/2001/XMLSchema" elements and data types should use the prefix xs:
This snippet:
Display elements defined by this schema (note, to, from, heading, body) from the namespace: "http://www.w3write.com".
This snippet:
It states that the default namespace is "http://www.w3write.com".
This snippet:
Identify any XML instance document used and the element declared in this schema must be over-defined namespace.
Schema referenced in the XML document
This XML document contains a reference to the XML Schema:
<note xmlns="http://www.w3write.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3write.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
The following code snippet:
It specifies a default namespace declaration. This declaration tells the schema validator that all the elements used in this XML document are declared in "http://www.w3write.com" namespace.
Once you have the XML Schema instance namespace available:
You can use the schemaLocation attribute. This property has two values. The first value is the namespace to use. The second value is the location for XML schema namespaces used: