开发者

XML Schema - elementFormDefault is unqualified but namespace prefix is used

开发者 https://www.devze.com 2023-03-06 00:34 出处:网络
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 qu开发者_StackOverflow社区alified

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 qu开发者_StackOverflow社区alified 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.


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.


elementFormDefault and attributeFormDefault are only defaults. It's always possible to specify form="qualified" on individual element and attribute declarations. And global element and attribute declarations are qualified by the target namespace unconditionally.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号