Correction tp(xml dtd)
Exercice 1 :
<?xml version="1.0" encoding="UTF-8"?>
<students>
<student>
<name>takwa</name>
<student_id>123456</student_id>
<email>takwa@[Link]</email>
<program_of_study>IT</program_of_study>
</student>
<student>
<name>rayen</name>
<student_id>789012</student_id>
<email>rayen@[Link]</email>
<program_of_study>Engineering</program_of_study>
</student>
<!-- Ajoutez d'autres étudiants au besoin -->
</students>
Exercice 2 :
<?xml version="1.0" encoding="UTF-8"?>
<calendar>
<event>
<date>2024-05-15</date>
<time>10:00 - 12:00</time>
<location>Room A</location>
<description>Team meeting</description>
</event>
<event>
<date>2024-05-20</date>
<time>14:00 - 16:00</time>
<location>Conference Hall</location>
<description>Project presentation</description>
</event>
<!-- Ajoutez d'autres événements au besoin -->
</calendar>
Exercice 3 :
<?xml version="1.0" encoding="UTF-8"?>
<catalogue>
<produit>
<nom>Smartphone</nom>
<description>Un smartphone de haute qualité avec des fonctionnalités
avancées.</description>
<prix>500</prix>
<disponibilite>En stock</disponibilite>
</produit>
<produit>
<nom>Ordinateur portable</nom>
<description>Un ordinateur portable puissant pour un usage
professionnel.</description>
<prix>1000</prix>
<disponibilite>En rupture de stock</disponibilite>
</produit>
<produit>
<nom>Écouteurs</nom>
<description>Écouteurs sans fil avec technologie de réduction de
bruit.</description>
<prix>150</prix>
<disponibilite>En stock</disponibilite>
</produit>
<!-- Ajoutez d'autres produits au besoin -->
</catalogue>
Exercice 4 : (correction ex1 dtd)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE students SYSTEM "[Link]">
<students>
<student>
<name>takwa</name>
<student_id>123456</student_id>
<email>takwa@[Link]</email>
<program_of_study>IT</program_of_study>
</student>
<student>
<name>rayen</name>
<student_id>789012</student_id>
<email>rayen@[Link]</email>
<program_of_study>Engineering</program_of_study>
</student>
<!-- Ajoutez d'autres étudiants au besoin -->
</students>
Dtd
<!ELEMENT students (student*)>
<!ELEMENT student (name, student_id, email, program_of_study)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT student_id (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT program_of_study (#PCDATA)>
Exercice 2☹dtd
<!ELEMENT calendar (event*)>
<!ELEMENT event (date, time, location, description)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT description (#PCDATA)>
Exercice 3 :dtd
<!ELEMENT catalogue (produit+)>
<!ELEMENT produit (nom, description, prix, disponibilite)>
<!ELEMENT nom (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT prix (#PCDATA)>
<!ELEMENT disponibilite (#PCDATA)>
Exercice 5
Xml
<BIBLIOTHEQUE>
<AUTEUR>
<NOM>Ahmed</NOM>
<PRENOM>Mohamed</PRENOM>
<LIVRE lang="arabe" ISBN="2-5678-6987-6" category="Informatique">
<DATE_EDITION>12-06-2010</DATE_EDITION>
<TITRE>titre livre 1</TITRE>
<EDITEUR>editeur 1</EDITEUR>
</LIVRE>
</AUTEUR>
<AUTEUR>
<NOM>Youssef</NOM>
<PRENOM>Ben Hammadi</PRENOM>
<LIVRE lang="arabe" ISBN="6-9876-2354-9" category="Mécanique">
<DATE_EDITION>09-08-2010</DATE_EDITION>
<TITRE>titre livre 2</TITRE>
<EDITEUR>editeur 2</EDITEUR>
</LIVRE>
<LIVRE lang="anglais" ISBN="6-9876-2354-9" category="Electrique">
<DATE_EDITION>14-07-2008</DATE_EDITION>
<TITRE>titre livre 3</TITRE>
<EDITEUR>editeur 2</EDITEUR>
</LIVRE>
</AUTEUR>
</BIBLIOTHEQUE>
Dtd
<?xml version="1.0"?>
<!DOCTYPE BIBLIOTHEQUE [
<!--DECLARATION DES ELEMENTS -->
<!ELEMENT BIBLIOTHEQUE (AUTEUR+)>
<!ELEMENT AUTEUR (NOM, PRENOM, LIVRE+)>
<!ELEMENT NOM (#PCDATA)>
<!ELEMENT PRENOM (#PCDATA)>
<!ELEMENT LIVRE (DATE_EDITION, TITRE, EDITEUR)>
<!ELEMENT DATE_EDITION (#PCDATA)>
<!ELEMENT EDITEUR (#PCDATA)>
<!ELEMENT TITRE (#PCDATA)>
<!--DECLARATION ATTRIBUTS -->
<!ATTLIST LIVRE lang CDATA #REQUIRED>
<!ATTLIST LIVRE ISBN CDATA #REQUIRED>
<!ATTLIST LIVRE category (Informatique | Mécanique | Electrique)
"Informatique">
]>
Exercice 6:
1 dtd
<!ELEMENT library (book+)>
<!ELEMENT book (title, authors+, chapters+, language, pages)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT authors (author+)>
<!ELEMENT author (first_name, last_name, country)>
<!ELEMENT first_name (#PCDATA)>
<!ELEMENT last_name (#PCDATA)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT chapters (chapter+)>
<!ELEMENT chapter (sections+)>
<!ELEMENT sections (paragraph+)>
<!ELEMENT paragraph (#PCDATA)>
<!ELEMENT language (#PCDATA)>
<!ELEMENT pages (#PCDATA)>
2 : xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library SYSTEM "[Link]">
<library>
<book>
<title>Evolution du monde</title>
<authors>
<author>
<first_name>Martin</first_name>
<last_name>Arthur</last_name>
<country>France</country>
</author>
</authors>
<chapters>
<chapter>
<sections>
<paragraph>Tout a commencé en 1900 où…</paragraph>
</sections>
</chapter>
</chapters>
<language>Français</language>
<pages>5</pages>
</book>
<book>
<title>La 2ème guerre mondiale</title>
<authors>
<author>
<first_name>John</first_name>
<last_name>Smith</last_name>
<country>Unknown</country>
</author>
</authors>
<chapters>
<chapter>
<sections>
<paragraph>That was the beginning of the 2nd world
war…</paragraph>
</sections>
</chapter>
</chapters>
<language>Anglais</language>
<pages>20</pages>
</book>
<book>
<title>Histoire du monde moderne</title>
<authors>
<author>
<first_name>François</first_name>
<last_name>Dupond</last_name>
<country>France</country>
</author>
</authors>
<chapters></chapters> <!-- Ajoutez d'autres chapitres si nécessaire --
>
<language>Français</language>
<pages>210</pages>
</book>
</library>
Exercice 7 :
<nouvelles>
<theme nom="actualites">
<breve langue="francais" date="YYYY-MM-DD">
<titre>Titre de la brève</titre>
<illustration>chemin/vers/[Link]</illustration>
<urls>
<url>
<lien>[Link]
<resume>Phrase résumant le contenu de la page</resume>
</url>
<!-- Autres URLs si nécessaire -->
</urls>
</breve>
<!-- Autres brèves sur le thème actualités -->
</theme>
<theme nom="sport">
<breve langue="anglais" date="YYYY-MM-DD">
<titre>Title of the brief</titre>
<illustration>chemin/vers/[Link]</illustration>
<urls>
<url>
<lien>[Link]
<resume>Summary of the page content</resume>
</url>
<!-- Autres URLs si nécessaire -->
</urls>
</breve>
<!-- Autres brèves sur le thème sport -->
</theme>
<!-- Autres thèmes et leurs brèves -->
</nouvelles>
Dtd :
<!ELEMENT nouvelles (theme+)>
<!ELEMENT theme (breve+)>
<!ATTLIST theme nom CDATA #REQUIRED>
<!ELEMENT breve (titre, illustration?, urls)>
<!ATTLIST breve langue (francais|anglais) #REQUIRED>
<!ATTLIST breve date CDATA #REQUIRED>
<!ELEMENT titre (#PCDATA)>
<!ELEMENT illustration (#PCDATA)>
<!ELEMENT urls (url+)>
<!ELEMENT url (lien, resume)>
<!ELEMENT lien (#PCDATA)>
<!ELEMENT resume (#PCDATA)>
<!ATTLIST LIVRE
lang CDATA #REQUIRED
ISBN CDATA #REQUIRED
>
Partie xsl :
Exercice 1 :
<xsd:schema xmlns:xs="[Link]
<xsd:element name="cv">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nom" type="xsd:string"/>
<xsd:element name="prenom" type="xsd:string"/>
<xsd:element name="age" type="xsd:string" minOccurs="0"/>
<xsd:element name="rubrique" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="titre" type="xsd:string"/>
<xsd:element name="contenu" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Exercice 2 :
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="[Link]
<xsd:element name="meteo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="region" type="xsd:string"/>
<xsd:element name="date" type="xsd:string"/>
<xsd:element name="phenomene" type="xsd:string"/>
<xsd:element name="temperature" type="temperatureType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="temperatureType">
<xsd:sequence>
<xsd:element name="matin" type="xsd:string"/>
<xsd:element name="soir" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>