Bonjour,
Je commence à me mettre aux dtd/xml en suivant le tutoriel pour faire ma dtd: http://zvon.developpez.com/tutoriels/dtd/
Donc au final, j'obtiens le resultat suivant:
dtd: listediaporama.dtd
Et pour le fichier xml: ListeDiaporama.xlm
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT ListeDiaporama (Diaporama*)> <!ATTLIST Diaporama idDiaporama CDATA #REQUIRED > <!ELEMENT Diaporama (Titre, ListeDiapo, Actif)> <!ELEMENT Titre (#PCDATA)> <!ELEMENT Actif (#PCDATA)> <!ELEMENT ListeDiapo (Diapo*)> <!ATTLIST Diapo idDiapo CDATA #REQUIRED> <!ELEMENT Diapo (Designation , Cible, Type, Duree)> <!ELEMENT Designation (#PCDATA)> <!ELEMENT Cible (#PCDATA)> <!ELEMENT Type (#PCDATA)> <!ELEMENT Duree (#PCDATA)>
Hors, dans ma dtd j'ai déclaré dans mon noeud "Diaporama" les noeuds:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ListeDiaporama SYSTEM "listediaporama.dtd" > <ListeDiaporama> <Diaporama idDiaporama="1"> <Titre>diaporama1</Titre> <ListeDiapo > <Diapo idDiapo="1" > <Designation>diapo1</Designation> <Cible>Fichier1</Cible> <Type>Video</Type> <Duree>120</Duree> </Diapo > <Diapo idDiapo="2"> <Designation>diapo2</Designation> <Cible>http:/aaa.com</Cible> <Type>Page Web</Type> <Duree>60</Duree> </Diapo> </ListeDiapo> <Actif>false</Actif> </Diaporama> <Diaporama idDiaporama="2"> <Titre>diaporama2</Titre> <ListeDiapo > <Diapo idDiapo="3" > <Designation>diapo3</Designation> <Cible>Fichier3</Cible> <Type>PowerPoint</Type> <Duree>120</Duree> </Diapo > <Diapo idDiapo="4"> <Designation>diapo4</Designation> <Cible>http:/aaa.com</Cible> <Type>Page Web</Type> <Duree>60</Duree> </Diapo> </ListeDiapo> <Actif>false </Actif> </Diaporama> </ListeDiaporama>
Titre, Actif et ListeDiapo
Mais dans mon xml je dois declarer mes noeuds dans l'ordre Titre,ListeDiapo et Actif... je trouve ca vraiment bizard.
Si j'ecris mon XML dans l'ordre de la dtd Eclipse m'indique une erreure au niveau du noeud Diaporama .
Je dois avoué ne pas comprendre d'où viens le problème.
EDIT:
Je viens de parser les 2 versions en Java avec SAX, les 2 fonctionnent... je pige pas![]()
Partager