我有一个项目,我目前正在尝试自定义。我尝试使用HTML创建商店定位器应用程序并调用url以XML格式输出数据。
输入表格我使用接受参数:
<!DOCTYPE html>
<html>
<head>
<title>Store Locator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div align="center">
<form action="SmartHomePage2.html" method="post">
<table cellspacing="5">
<tr>
<td colspan="2" align="center">
<h2>Store Locator</h2>
</td>
</tr>
<tr>
<td align="right">
Enter Your Zip Code:
</td>
<td>
<input type="text" name="zip" value="" />
</td>
</tr>
<tr>
<td align="right">
Enter the search radius in miles:
</td>
<td>
<input type="text" name="dist" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Search" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
以下是我的输出页面的样子:
<!DOCTYPE html>
<html>
<head>
<title>Search Results</title>
</head>
<body>
<h1>Best Buy Results</h1>
<c:import url="http://api.remix.bestbuy.com/v1/stores(area
(${param.zip},${param.dist}))?show=storeId,name,distance,lat,lng
&apiKey=ruuk8c4ux2p4e7d6bfftzuda" var="message" />
<x:parse var="a" doc="${message}" />
<x:forEach var="current" select="$a/stores/store">
<b> Store ID: </b> <x:out select="$current/storeId" />
<br />
<b> Name: </b> <x:out select="$current/name" />
<br />
<b> Distance: </b> <x:out select="$current/distance" />
<br />
<b> Latitude: </b> <x:out select="$current/lat" />
<br />
<b> Longitude: </b> <x:out select="$current/lng" />
<br />
</li>
</ul>
</x:forEach>
</body>
</html>
我的问题是如何使用HTML输出XML数据?或者我需要合并一些JavaScript?
提前谢谢。