Attribute "use" support
The use
property in the attribute definition
declares the attribute to be required
, optional
, or prohibited
.
For example, in this schema definition:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="myElement">
<xsd:complexType>
<xsd:attribute name="a" use="required"/>
<xsd:attribute name="b" use="optional"/>
<xsd:attribute name="c" use="prohibited"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
These instances are both permitted within this definition:
<myElement a="mya"/>
<myElement a="mya" b="myb"/>
This is not permitted:
<myElement a="mya" c="myc"/>