Salut,
A vrai dire je ne sais pas si ma question relève de xml ou de html.
J'aimerais représenter un fichier xml dans du html. J'ai cherché mais je n'ai rien trouvé. Cependant le code que je vous présente ci dessous fonctionnait bien il y a des lustres.
Comment parvenir aujourd'hui au résultat attendu avec Windows et Linux ?
Dans le même répertoire:
fichier inv01.xml:
le fichier tinv.html :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <?xml version = '1.0' encoding = 'UTF-8'?> <inventaire> <livre> <titre>La vie des animaux</titre> <auteur>Silverstone Stèline</auteur> <prix>155 </prix> </livre> <livre> <titre>Viens à la maison</titre> <auteur>Clocloché</auteur> <prix>175 </prix> </livre> </inventaire>
Ben voilà, j'y comprends pas grand chose.
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 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <title>Tableau inventaire</title> </head> <body> <xml id="dsoInv" src="inv01.xml"></xml> <h2>Tableau des livres</h2> <table id="tablib" datasrc="#dsoInv" datapagesize="4" border="1" cellpadding="5"> <thead> <tr> <th>Titre</th> <th>Auteur</th> <th>Prix</th> </tr> </thead> <tbody> <tr> <td><span datafld="titre"></span></td> <td><span datafld="auteur"></span></td> <td><span datafld="prix"></span></td> </tr> </tbody> </table> <button onclick="tablib.firstpage()">Début page</button> <button onclick="tablib.lastpage()">Dernière Page</button> <button onclick="tablib.nextPage()">Page suivante</button> <button onclick="tablib.previousPage()">Page précèdente</button> </body> </html>
Partager