diaporamaMiscXML
 
◃  Ch. 2 XML Schema  ▹
 

Substitution et heritage

<xsd:element name="Librairie">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element ref="publication" type="typePublication" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>
<xsd:complexType name="typePublication">
  <xsd:sequence>
    <xsd:element name="Titre" type="xsd:string"/>
    <xsd:element name="Auteur" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    <xsd:element name="Date" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>
<xsd:element name="magazine" substitutionGroup="publication" type="typeMagazine" maxOccurs="unbounded" />
<xsd:element name="livre" substitutionGroup="publication" type="typeLivre" maxOccurs="unbounded" />
<xsd:complexType name="typeLivre">
 <xsd:complexContent>
   <xsd:extension base="typePublication">
     <xsd:sequence>
       <xsd:element name="ISBN" type="xsd:string"/>
       <xsd:element name="Editeur" type="xsd:string"/>
     </xsd:sequence>
   <xsd:extension>
 </xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="typeMagazine">
 <xsd:complexContent>
    <xsd:restriction base="typePublication">
      <xsd:sequence>
        <xsd:element name="Titre" type="xsd:string"/>
        <xsd:element name="Auteur" type="xsd:string" minOccurs="0" maxOccurs="0"/>
        <xsd:element name="Date" type="xsd:string"/>
      </xsd:sequence>
    </xsd:restriction/">
  </xsd:complexContent>
</xsd:complexType>