views:

40

answers:

2

This code works only in IE6 why it is? and how else i can display my xml in html (without css)?

<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>

*UPDATE:*Exists also solution using XSLT http://www.w3schools.com/xsl/xsl_for_each.asp

+2  A: 

This code works only in IE6 why it is?

Because it is non-standard proprietary code.

and how else i can display my xml in html (without css)?

Use a programming language to convert the data to HTML and insert it into the document. Do it server side if you want best compatibility and search engine friendliness.

David Dorward
+2  A: 

This is IE proprietary code that isn't part of any HTML spec. If you want to import XML you'll have to do it with a server-side script or, at worst, Javascript.

Estel