XSD కంప్లెక్స్ ఖాళీ మూలకం

ఖాళీ కంప్లెక్షన్ మెలకువ కంటెంట్ లేదు, మాత్రమే అంశాలు కలిగి ఉండవచ్చు.

కంప్లెక్షన్ ఖాళీ మెలకువ:

ఒక ఖాళీ XML మెలకువ:

<product prodid="1345" />

పైని "product" మెలకువ ఏ కంటెంట్ లేదు. కానీ కంటెంట్ లో మాత్రమే మెలకువలు కలిగిన టైప్ నిర్వచించడానికి, మరియు ఏ మెలకువలనూ పేర్కొనబడదు, ఉదాహరణకు ఈ విధంగా:

<xs:element name="product">
  <xs:complexType>
    <xs:complexContent>
      <xs:restriction base="xs:integer">
        <xs:attribute name="prodid" type="xs:positiveInteger"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

పైని ఉదాహరణలో, మేము ఒక కంప్లెక్షన్ కంటెంట్ కలిగిన కంప్లెక్షన్ టైప్ నిర్వచించాము. <complexContent> మెలకువ ఇచ్చే సంకేతం అనగా, మేము కంప్లెక్షన్ టైప్ కంటెంట్ మోడల్ని పరిమితం చేయాలని లేదా విస్తరించాలని ఉద్దేశించాము, మరియు <integer> పరిమితం ఒక అంశాన్ని పేర్కొంది కానీ ఏ మెలకువలు ప్రవేశపెట్టదు.

కానీ, ఈ "product" మెలకువను మరింత కంప్యక్ట్లవంతంగా పేర్కొనవచ్చు:

<xs:element name="product">
  <xs:complexType>
    <xs:attribute name="prodid" type="xs:positiveInteger"/>
  </xs:complexType>
</xs:element>

లేదా మీరు ఒక complexType మూలకానికి పేరు పెట్టవచ్చు, మరియు "product" మూలకానికి type అంశాన్ని అనుసరించి ఈ complexType పేరును ఉపయోగించవచ్చు (ఈ పద్ధతి ద్వారా, అనేక మూలకాలు ఒకే కంప్లెక్స్ టైప్ ను ఉపయోగించవచ్చు):

<xs:element name="product" type="prodtype"/>
<xs:complexType name="prodtype">
  <xs:attribute name="prodid" type="xs:positiveInteger"/>
</xs:complexType>