Default XSD attribute use indicator values?

117 Views Asked by At

What are default values of indicators in XSD Schema when they aren't define directly?

How many times (min and max) and what order in should (or can) I define attributes of foo in XML?

<xs:complexType name="foo">
    <xs:attribute name="name1" type="xs:string"/>
    <xs:attribute name="name2" type="xs:string"/>
</xs:complexType>

P.S. This example is for a real and working project.

1

There are 1 best solutions below

1
kjhughes On BEST ANSWER

In XSD the xsd:attribute/@use attribute determines whether an XML attribute may, must, or must not appear:

  • optional: The attribute may appear but need not. This is the default value.
  • required: The attribute must appear.
  • prohibited: The attribute must not appear.

In XML there can only be at most a single attribute with a given name per element, and the order of attributes is insignificant.

See also