XSD - Gecompositeerde typen - Alleen elementen

The composite type elements that are "only elements" can only contain other elements.

Composite types only contain elements

XML elements, "person", only contain other elements:

<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>

You can define the "person" element in the schema like this:

<xs:element name="person">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstname" type="xs:string"/>
      <xs:element name="lastname" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Please note this <xs:sequence> element. It means that the defined elements must appear in the order above in the "person" element.

Of course, you can also set a name for the complexType element and let the type attribute of the "person" element refer to this name (if you use this method, several elements can refer to the same complex type):

<xs:element name="person" type="persontype"/>
<xs:complexType name="persontype">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  </xs:sequence>
</xs:complexType>