xml:base, xml:id, xml:lang, xml:space
The namespace http://www.w3.org/XML/1998/namespace is, according to the XML Namespaces specification, bound by definition to the xml: prefix. What this means is that this is the namespace that must be used with the xml: prefix and that is reserved for it. There are four attributes in this namespace that can be children of any XML element in any XML document (schema or instance):
•xml:base (for setting the base URI of an element)
•xml:id (for specifying the unique ID of an element)
•xml:lang (for identifying the language used within that element)
•xml:space (for specifying how whitespace in the element should be handled)
In Schema View, once the XML Namespaces namespace has been imported into the XML Schema document, these four xml: attributes can be referenced for use on any element in the schema.
In order to declare one of these attributes on an element, do the following:
1.Declare the XML Namespaces namespace for that schema document and bind the namespace to the xml: prefix. When any of the four xml: attributes is used in the document, its name would then be expanded to include the correct namespace part.
2.Import the XML Namespaces namespace. XMLSpy's validator will recognize the namespace and make the four xml: attributes available as global attributes, which can be referenced within that schema.
3.Insert the required xml: attribute as the child of an element. The attribute is declared as a reference to the "imported" global attribute.
Declare the XML Namespaces namespace
You can declare the XML Namespaces namespace (http://www.w3.org/XML/1998/namespace) by entering it via the Schema Settings dialog, where all namespaces declared for that schema are stored and can be edited. The namespace must be bound to the xml: prefix. (Alternatively, you could declare the namespace (with the xml: prefix) on the xs:schema element in Text View.)
Import the XML Namespaces namespace
In Schema Overview, create a global import declaration for the XML Namespaces namespace. Do this by clicking the Insert or Append icon at the top of the Schema Overview window and selecting Import from the menu that pops up. Enter the XML Namespaces namespace as the namespace to be imported. In Text View, the import declaration should look like this:
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/XML/1998/namespace"/>.
Adding the xml: attribute
In Schema Overview, select the element for which the xml: attribute is to be added, and add an attribute for it. In the Details entry helper (screenshot below), click the down arrow of the name combo box and select the required xml: attribute, for example xml:base. When you are prompted whether you wish to reference the global attribute, click Yes. The attribute is added as a reference.
XInclude and xml:base
When XInclude's include element is replaced by the XML file specified in the href attribute of the include element, the top-level element of the parsed XML document is included with an xml:base attribute. If this XML document is going to be validated, then the schema must define an xml:base attribute on the relevant element/s.