此代码仅适用于IE6,为什么会这样?以及如何在html中显示我的xml(没有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>
* 更新: *还存在使用XSLT的解决方案http://www.w3schools.com/xsl/xsl_for_each.asp
答案 0 :(得分:2)
此代码仅适用于IE6,为什么会这样?
因为它是非标准的专有代码。
以及如何在html中显示我的xml(没有css)?
使用编程语言将数据转换为HTML并将其插入到文档中。如果您想要最佳兼容性和搜索引擎友好性,请在服务器端进行。
答案 1 :(得分:2)
这是IE专有代码,不属于任何HTML规范。如果要导入XML,则必须使用服务器端脚本,或者最糟糕的是,使用Javascript。