XSD - The <schema> Element
The
<schema> element is the root element of every XML Schema.
Example:
<?xml
version="1.0"?>
<xs:schema>
... ...
</xs:schema>
The
<schema> element may contain some attributes.
A schema declaration often looks something
like this:
<?xml
version="1.0"7>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.yahoo.com" xmlns="http://www.yahoo.com"
elementFormDefault="qualified">
... ...
</xs:schema>
The <schema> Element Attributes
Here,
you can see examples of the schema elements and its explanation.
xmlns:xs="http://www.w3.org/2001/XMLSchema"
This
fragments indicates that the elements and data types used in the schema come
from the "http://www.w3.org/2001/XMLSchema" namespace. It also
specifies that the elements and data types that come from the
"http://www.w3.org/2001/XMLSchema"
namespace should be prefixed with xs:
targetNamespace="http://www.yahoo.com"
This
fragment indicates that the elements defined by this schema (note, to, from,
heading, body) come from the “http://www.yahoo.com" namespace.
xmlns="http://www.yahoo.com"
This
fragment indicates that the default namespace is “http://ww w.yahoo.com".
elementFormDefault="qualified"
This
fragment indicates that any elements used by the XML instance document which
were declared in this schema must be namespace qualified.