2010-09-25 3 views
1

Ce code fonctionne uniquement dans IE6 pourquoi? et comment je peux afficher mon xml en html (sans css)?Affichage XML en HTML, fonctionne uniquement en IE6

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 
<body> 
<xml id="xmlcatalog" src="catalog.xml"> 
</xml> 
<table datasrc = "#xmlcatalog" width="100%"> 
    <thead> 
     <th>Image</th> 
     <th>Date</th> 
     <th>Time</th> 
     <th>Title</th> 
     <th>Author</th> 
     <th>Genre</th> 
    </thead> 
    <tr align="left"> 
     <td><span datafld="image"></span></td> 
     <td><span datafld="date"></span></td> 
     <td><span datafld="time"></span></td> 
     <td><span datafld="title"></span></td> 
     <td><span datafld="author"></span></td> 
     <td><span datafld="genre"></span></td>   
    </tr> 
</table> 
</body> 
</html> 

XML

<?xml version="1.0" encoding="windows-1251"?> 
<catalog> 
<spectacle> 
    <image>Lir.gif</image> 
    <date> 16.09.10</date> 
    <time> 19:00</time> 
    <title> King Lear</title> 
    <author> William Shakespeare/author> 
    <genre> tragedy </genre> 
</spectacle> 
</catalog> 

* MISE À JOUR: * Existe aussi solution en utilisant XSLT http://www.w3schools.com/xsl/xsl_for_each.asp

+1

Wow, "XML Data Islands". Je ne t'ai pas vu depuis * longtemps *. Ne me manquez pas beaucoup. – bobince

Répondre

2

Ce code ne fonctionne que dans IE6 pourquoi il est?

Parce que c'est un code propriétaire non standard.

et comment puis-je afficher mon xml en html (sans css)?

Utilisez un langage de programmation pour convertir les données au format HTML et les insérer dans le document. Faites-le côté serveur si vous voulez la meilleure compatibilité et la convivialité des moteurs de recherche.

2

Ceci est un code propriétaire IE qui ne fait partie d'aucune spécification HTML. Si vous voulez importer du XML, vous devrez le faire avec un script côté serveur ou, au pire, Javascript.