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.
![XSD - The <schema> Element XSD - The <schema> Element](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh22D9E_x2TngUEpj8rtwMthKnelkEJRhKx-s7h87QqPcKJCTpswxt44p1yVKw3XFM7_BGRicLi-zTBjfJkpL3QkfGg1YFkhqknhyphenhyphenmJHkpEBvLNbTMMB0VKE9PEZ70-7ja2KNxvan4n0lU/s1600/XML+Introduction.jpg)
![XSD - The <schema> Element XSD - The <schema> Element](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBYKTI6kHcRMIK_WCcGQg5rBr2UTrQHwiXhdqHKT28JB8pQztqjWUv-aPXKF1UxTt-LfqUC3mu3yPxERQAVOPY6GMnS5ATo9Gm4HN5nWoqgjaEaiEQK68eE6EeGXdjKQipv4m5LhQaMF0/s1600/XML+Introduction.jpg)