xmlxsdxsd-validationxml-validationxmlschema

Default XSD attribute use indicator values?


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.


Solution

  • In XSD the xsd:attribute/@use attribute determines whether an XML attribute may, must, or 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