Beruflich Dokumente
Kultur Dokumente
Ex1
Voici le document XML que nous avions construit :
Code : XML
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<repertoire>
<!-- John DOE -->
<personne sexe="masculin">
<nom>DOE</nom>
<prenom>John</prenom>
<adresse>
<numero>7</numero>
<voie type="impasse">impasse du chemin</voie>
<codePostal>75015</codePostal>
<ville>PARIS</ville>
<pays>FRANCE</pays>
</adresse>
<telephones>
<telephone type="fixe">01 02 03 04 05</telephone>
<telephone type="portable">06 07 08 09 10</telephone>
</telephones>
<emails>
<email type="personnel">john.doe@wanadoo.fr</email>
<email type="professionnel">john.doe@societe.com</email>
</emails>
</personne>
<!-- Marie POPPINS -->
<personne sexe="feminin">
<nom>POPPINS</nom>
<prenom>Marie</prenom>
<adresse>
<numero>28</numero>
<voie type="avenue">avenue de la république</voie>
<codePostal>13005</codePostal>
<ville>MARSEILLE</ville>
<pays>FRANCE</pays>
</adresse>
<telephones>
<telephone type="bureau">04 05 06 07 08</telephone>
</telephones>
<emails>
<email type="professionnel">contact@poppins.fr</email>
</emails>
2
</personne>
</repertoire>
Exercice 2
<?xml version="1.0"?>
<!DOCTYPE carnet SYSTEM "carnet.dtd">
<carnet>
<personne nom="dupont" prenom="jean" telephone="001122"/>
<personne nom="dupond" telephone="221100"/>
</carnet>
Exercice 3
<!ELEMENT livre (auteurs,sections)>
<!ELEMENT auteurs (auteur+)>
<!ELEMENT auteur EMPTY>
<!ELEMENT sections (section+)>
<!ELEMENT section (chapitre,chapitre+)>
<!ELEMENT chapitre (paragraphe,paragraphe+)>
<!ELEMENT paragraphe (#PCDATA)>
<!ATTLIST livre titre CDATA #REQUIRED>
<!ATTLIST section titre CDATA #REQUIRED>
<!ATTLIST chapitre titre CDATA #REQUIRED>
<!ATTLIST auteur
nom CDATA #REQUIRED
prenom CDATA #REQUIRED>
livre xml
<?xml version="1.0" encoding="iso-8859-1"?>
<livre titre="Mon livre">
<auteurs>
4
<auteur nom="Brillant" prenom="Alexandre"/>
<auteur nom="Briand" prenom="Aristide"/>
</auteurs>
<sections>
<section titre="Section 1">
<chapitre titre="Chapitre 1">
<paragraphe>Premier paragraphe</paragraphe>
<paragraphe>Deuxième paragraphe</paragraphe>
</chapitre>
<chapitre titre="Chapitre 2">
<paragraphe>Premier paragraphe</paragraphe>
<paragraphe>Deuxième paragraphe</paragraphe>
</chapitre>
</section>
<section titre="Section 2">
<chapitre titre="Chapitre 1">
<paragraphe>Premier paragraphe</paragraphe>
<paragraphe>Deuxième paragraphe</paragraphe>
</chapitre>
<chapitre titre="Chapitre 2">
<paragraphe>Premier paragraphe</paragraphe>
<paragraphe>Deuxième paragraphe</paragraphe>
</chapitre>
</section>
</sections>
</livre>
Exercice 4
<!ELEMENT livre (auteurs,sections)>
<!ELEMENT auteurs (auteur+)>
<!ELEMENT auteur EMPTY>
<!ELEMENT sections (section+)>
<!ELEMENT section (chapitre,chapitre+)>
<!ELEMENT chapitre (paragraphe,paragraphe+)>
<!ELEMENT paragraphe (#PCDATA)>
<!ENTITY % titre "titre CDATA #REQUIRED">
<!ATTLIST livre
%titre;>
<!ATTLIST section
%titre;>
<!ATTLIST chapitre
%titre;>
<!ATTLIST auteur
nom CDATA #REQUIRED
prenom CDATA #REQUIRED>