嗨我试图在HTML页面上显示XML数据。使用<输入DATAFLD =“...”>在HTML中显示一些复杂的XML数据</input>
我没有用简单的XML文件,就像任何问题:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
问题是这样的复杂行为:
<?xml version="1.0"?>
<!DOCTYPE addressbook SYSTEM "addressbook.dtd">
<addressbook>
<contact>
<name>Evren Ozturk</name>
<address>Adress here!</address>
<city>Varna</city>
<zip>35500</zip>
<phone>
<mobile>0999999999</mobile>
<landline>232-000-1234</landline>
<fax>232-000-1234</fax>
</phone>
<email>[email protected] </email>
<company>Asis Bg</company>
</contact>
</addressbook>
在这个例子中,我可以看到这些:姓名,地址,城市,邮编,电子邮件,公司。 但我看不到移动,固定电话和传真的价值。 下面是我使用的显示数据代码:
<HTML>
<HEAD>
<title>Evren Ozturk</TITLE>
</HEAD>
<BODY>
<XML id="addressbook" src="addressbook.xml"></XML>
<!--XML DATA BOUND TABLE-->
<table DATASRC="#addressbook" >
<tr><thead bgcolor=tan>
<th>name</th>
<th>address</th>
<th>city</th>
<th>zip</th>
<th>mobile</th>
<th>landline</th>
<th>fax</th>
<th>email</th>
<th>company</th></thead>
</tr>
<tr>
<td><input DATAFLD="name"></input></td>
<td><input DATAFLD="address"></input></td>
<td><input DATAFLD="city"></input></td>
<td><input DATAFLD="zip"></input></td>
<td><input DATAFLD="mobile"></input></td>
<td><input DATAFLD="landline"></input></td>
<td><input DATAFLD="fax"></input></td>
<td><input DATAFLD="email"></input></td>
<td><input DATAFLD="company" ></input></td>
</tr>
</table>
<hr color=SteelBlue width=500 height=5 align=left>
</BODY>
</HTML>
下面是这些代码的结果的SS:
的我的原因是新用户,我不能上传图片8D所以我'开放点8P
我现在没有必要是移动和等。在手机内部,但无论我在哪里看:我只是看到了相同的简单示例。我只是想这样做8)如果你能帮助我,它真的会很棒。谢谢你给你的时间。
你似乎是试图使用XML数据岛。别。它们是专有和非标准的MSIE功能,尚未被广泛接受。用编程语言处理数据(最好在运行在服务器上的程序中)并输出HTML代替。 – Quentin 2011-05-24 14:33:18
我建议读一读XSL。 – Spudley 2011-05-24 15:03:27
感谢您的建议......在此之前,我使用AvtiveX来显示xml,如下所示: ** Artists = XML.getElementsByTagName(“Artist”); 艺术家[Person] .childNodes(1).text ** 只是试图使用这些代码,我提出了这个问题,它看起来像更简单的方法。 – 2011-05-24 15:13:46