0% found this document useful (0 votes)
8 views3 pages

TP3 Schema

Uploaded by

hanane aissaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

TP3 Schema

Uploaded by

hanane aissaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

exercice 1 :

<?xml version="1.0" encoding="UTF-8"?>


<list xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<a>123</a>
<b>456</b>
<b>789</b>
</list>
DtD equivalent : ------
<!DOCTYPE list [
<!ELEMENT list (a,b+)>
<!ELEMENT a (#PCDATA)>
<!ELEMENT b (#PCDATA)>
<!ATTLIST b maxOccurs (unbounded) #IMPLIED>
]>

2)----------------------------------------------------------
<?xml version="1.1" encoding="UTF-8"?>
<list xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<a>123</a>
<b>456</b>
<a>789</a>
<b>112</b>
</list>
DtD equivalent : -------
<!DOCTYPE list [
<!ELEMENT list (a,b)+>
<!ELEMENT a (#PCDATA)>
<!ELEMENT b (#PCDATA)>
]>

------------------------------------------------------------
exercice 2 :
1)-------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="sac">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="objet" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="portefeuille" type="xsd:string"/>
<xsd:element name="cahier" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
2)------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="sac">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="objet" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="portefeuille" type="xsd:string">
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:element>
<xsd:element name="cahier" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
---------------------------------------------------------
exercice 3 :
1)-----------------------------------
<!ELEMENT repertoire (personne+)>
<!ELEMENT personne (nom, prenom, sexe, adresse, telephone+, email+)>
<!ELEMENT nom (#PCDATA)>
<!ELEMENT prenom (#PCDATA)>
<!ELEMENT sexe (#PCDATA)>
<!ELEMENT adresse (#PCDATA)>
<!ELEMENT telephone (#PCDATA)>
<!ELEMENT email (#PCDATA)>
2)-----------------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="repertoire">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="personne" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nom" type="xsd:string"/>
<xsd:element name="prenom" type="xsd:string"/>
<xsd:element name="sexe" >
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="homme"/>
<xsd:enumeration value="femme"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="adresse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="numero" type="xsd:int"/>
<xsd:element name="type_voie">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="impasse"/>
<xsd:enumeration value="avenue"/>
<xsd:enumeration value="rue"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="nom_voie"
type="xsd:string"/>
<xsd:element name="ville"
type="xsd:string"/>
<xsd:element name="code_postal"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="telephone" minOccurs="0"
maxOccurs="unbounded">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{2}\s\d{2}\s\d{2}\s\
d{2}\s\d{2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="email" minOccurs="0"
maxOccurs="unbounded">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value=".+@.+\..+"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

You might also like