开发者

XML Schema: "use='required'" with default value

开发者 https://www.devze.com 2022-12-08 20:07 出处:网络
In an XML Schema, is it possible to have an element which has use=\'required\' and a default value (e.g. <xs:attribute name=\"Version\" type=\"U8\" use=\"required\" default=\"02\"/开发者_Go百科>

In an XML Schema, is it possible to have an element which has use='required' and a default value (e.g. <xs:attribute name="Version" type="U8" use="required" default="02"/开发者_Go百科>)?


At least XMLSpy chokes on this one:

[...] In attribute declaration 'Version', 'use' must have the value 'optional' because the attribute 'default' is present.

A look into XML Schema Part 1: Structures Second Edition yields 3.2.3 Constraints on XML Representations of Attribute Declarations:

[...] If default and use are both present, use must have the ·actual value· optional. [...]

So the answer obviously is: NO

0

精彩评论

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