What do the xml:mstns express in the following xsd-header?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="config"
targetNamespace="http:/tempuri.org/config.xsd"
elementFormDefault="qualified"
xmlns=""
xmlns:mstns="http://tempuri.org/config.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="config">
...
That’s an XML namespace declaration.
XML namespaces are really defined by URIs, so that a qualified name consists of a namespace (an arbitrary URI) and a local name (a short simple string following the NCName rules). However, that can’t be written out in full every time, so namespaces are mapped to prefixes by a namespace declaration, which always takes the form of an attribute starting with
xmlnsand which defines that prefix for the element containing it and all its child elements.Let’s take your case as an example.
We have an attribute
xmlns:mstns="http://tempuri.org/config.xsd", and that simply says that the prefixmstnsis mapped to the namespace URIhttp://tempuri.org/config.xsd; this means that all elements and attributes whose names start withmstns:(note the colon) are in that namespace. In your example we also seexmlns="", which maps all elements (tricky point: not attributes!) without prefix to the empty URI.Obviously, you can’t use
xmlnsitself as a prefix (it’s magical) and in fact all prefixes starting withxmlare reserved. There’s a common habit of using thetnsprefix in schemas to indicate the Target NameSpace.