XSD ਕੰਪਲੈਕਸ ਟਾਈਪ - ਮਿਸ਼ਰਿਤ ਸਮੱਗਰੀ

ਮਿਕਸਡ ਕੰਪਲੈਕਸ ਟਾਈਪ ਅਟਰੀਬਿਊਟ, ਐਲੀਮੈਂਟ ਅਤੇ ਟੈਕਸਟ ਸਮੂਹ ਸ਼ਾਮਲ ਕਰ ਸਕਦਾ ਹੈ。

ਮਿਕਸਡ ਕੰਟੈਂਟ ਕੰਪਲੈਕਸ ਟਾਈਪ

XML ਐਲੀਮੈਂਟ, "letter", ਟੈਕਸਟ ਅਤੇ ਹੋਰ ਐਲੀਮੈਂਟ ਰੱਖਦਾ ਹੈ:

<letter>
ਦੇਅਰ ਮਿਸਟਰ.<name>John Smith</name>.
ਤੁਹਾਡਾ ਆਰਡਰ <orderid>1032</orderid>
ਸ਼ਿਪ ਹੋਵੇਗਾ <shipdate>2001-07-13</shipdate>.
</letter>

ਹੇਠ ਲਿਖੇ schema ਨੇ ਇਸ "letter" ਐਲੀਮੈਂਟ ਨੂੰ ਐਲਾਨਿਆ:

<xs:element name="letter">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:element name="orderid" type="xs:positiveInteger"/>
      <xs:element name="shipdate" type="xs:date"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

ਟਿੱਪਣੀ:ਜਿਵੇਂ ਕਿ "letter" ਐਲੀਮੈਂਟ ਦੇ ਉਪ ਐਲੀਮੈਂਟ ਵਿੱਚ ਅੱਖਰਾਂ ਦਾ ਦਰਸਾਵਾ ਹੋਵੇ, mixed ਅਟਰੀਬਿਊਟ ਨੂੰ "true" ਮੁੱਲ ਦੇਣਾ ਹੈ。<xs:sequence> ਟੈਗ (name, orderid ਅਤੇ shipdate) ਮਤਲਬ ਹੈ ਕਿ ਪਰਿਭਾਸ਼ਿਤ ਐਲੀਮੈਂਟ ਨੂੰ ਇੱਕ ਕਰਕੇ ਇੱਕ ਦੇ ਅੰਦਰ "letter" ਐਲੀਮੈਂਟ ਵਿੱਚ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ。

ਅਸੀਂ complexType ਐਲੀਮੈਂਟ ਨੂੰ ਇੱਕ ਨਾਮ ਵੀ ਦੇ ਸਕਦੇ ਹਾਂ, ਅਤੇ "letter" ਐਲੀਮੈਂਟ ਦੇ type ਅਟਰੀਬਿਊਟ ਨੂੰ complexType ਦੇ ਇਸ ਨਾਮ ਨੂੰ ਹਵਾਲਾ ਦੇ ਸਕਦੇ ਹਾਂ (ਇਸ ਤਰ੍ਹਾਂ, ਕਈ ਐਲੀਮੈਂਟ ਇੱਕ ਹੀ ਕੰਪਲੈਕਸ ਟਾਈਪ ਨੂੰ ਹਵਾਲਾ ਦੇ ਸਕਦੇ ਹਨ):

<xs:element name="letter" type="lettertype"/>
<xs:complexType name="lettertype" mixed="true">
  <xs:sequence>
    <xs:element name="name" type="xs:string"/>
    <xs:element name="orderid" type="xs:positiveInteger"/>
    <xs:element name="shipdate" type="xs:date"/>
  </xs:sequence>
</xs:complexType>