Search code examples
xmlnamespacesxsdqualified

XML Schema - elementFormDefault is unqualified but namespace prefix is used


I am not an expert on XML Schema so I am wondering how can the following be correct:

In emma (http://www.w3.org/TR/emma/) all examples given are using fully qualified emma (both at elements and attributes) like:

<emma:emma version="1.0" xmlns:emma="http://www.w3.org/2003/04/emma"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org/2003/04/emma
    http://www.w3.org/TR/2009/REC-emma-20090210/emma.xsd"
    xmlns="http://www.example.com/example">
    <emma:interpretation id="r1" emma:medium="acoustic" emma:mode="voice">
        ...
    </emma:interpretation>
</emma:emma>

but the http://www.w3.org/TR/emma/emma.xsd defines:

elementFormDefault="unqualified" attributeFormDefault="unqualified"

And I don't see how prefixes are enabled on the element / attribute level either.

I wonder, how can that be correct? There must be a flaw in my understanding of XML Schema.


Solution

  • Because in every complex type where an element is defined, it is a reference to a global element, hence qualified. The element form applies only to local elements, not global.