Home > Back-end >  Default XSD attribute use indicator values?
Default XSD attribute use indicator values?

Time:07-29

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.

CodePudding user response:

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

  • Related