Firstly, the two declarations:
xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns="http://www.w3.org/2001/XMLSchema"
indicate that both names prefixed "xs", and unprefixed names, represent names whose meaning is defined in the W3C XSD specification. This gives you a choice of writing <xs:element>
or simply <element>
. There's no particular reason for declaring both; it's better to use one form or the other consistently.
The attribute targetNamespace="http://www.example.org/schema"
indicates that this schema is defining the structure of elements (and perhaps attributes) in the namespace http://www.example.org/schema, which is presumably a namespace for which you are the design control (by which I mean, you shouldn't be using that particular namespace except in an example, because it's not your namespace).
It's quite common to see a declaration like
xmlns:tns="http://www.example.org/schema"
that binds a prefix (in this case "tns") to the target namespace of the schema. If you have one schema component that references another one in the same target namespace (for example an element declaration referencing a type), then there are two ways of doing it:
(1) <xs:element name="e" type="t"/>
This works when the "xs" prefix is bound to "http://www.w3.org/2001/XMLSchema" and the default namespace is the same as the target namespace.
(2) <element name="e" type="tns:t"/>
This works when the default namespace is "http://www.w3.org/2001/XMLSchema" and the "tns" prefix is bound to the target namespace.