views:

202

answers:

1

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"/>)?

+1  A: 

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

Stefan Gehrig