XSD - <schema>
Element
The <schema>
element is the root element of every XML Schema.
<schema>
Element
The <schema>
element is the root element of every XML Schema:
The <schema>
element can contain attributes. A schema declaration often looks like this:
The following code snippet:
Shows that the elements and data types used in the schema come from the namespace "http://www.w3.org/2001/XMLSchema". It also specifies that elements and data types from the namespace "http://www.w3.org/2001/XMLSchema" should use the prefix xs:
This snippet:
Shows that the elements defined by this schema (note, to, from, heading, body) come from the namespace: "http://www.tutorialpro.org".
This snippet:
Indicates that the default namespace is "http://www.tutorialpro.org".
This snippet:
Indicates that any elements used in the XML instance document that are declared in this schema must be namespace-qualified.
Referencing Schema in XML Document
This XML document contains a reference to the XML Schema:
The following code snippet:
Specifies the declaration of the default namespace. This declaration tells the schema validator that all elements used in this XML document are declared in the namespace "http://www.tutorialpro.org".
Once you have the XML Schema instance namespace available:
You can use the schemaLocation attribute. This attribute has two values. The first value is the namespace to be used. The second value is the location of the XML schema for the namespace: