एक्सएसडी संयुक्त टाइप - केवल एलीमेंट

“केवल एलीमेंट्स” के संयुक्त तरीके के एलीमेंट केवल अन्य एलीमेंट्स को शामिल कर सकते हैं

संयुक्त तरीके केवल एलीमेंट्स को शामिल करता है

XML एलीमेंट, "person", केवल अन्य एलीमेंट्स को शामिल करता है:

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

आप schema में इस तरीके से "person" एलीमेंट को डिफाइन कर सकते हैं:

<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>

इस <xs:sequence> पर ध्यान दें। यह इसका मतलब है कि डिफाइन्ड एलीमेंट को "person" एलीमेंट में उपर दिए गए क्रम में दिखाया जाना चाहिए。

या आप complexType एलीमेंट को एक नाम दे सकते हैं और "person" एलीमेंट के 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>