我正嘗試在Google網站中使用自定義Google小工具,以便能夠使用JavaScript。我已經把代碼放在下面。它基本上鍊接到已發佈的電子表格,並使用Google可視化API創建可排序的可搜索界面。「hl」必須以Google小工具代碼中的分隔符錯誤結尾
我不知道任何免費網站來承載一個XML文件。所以我上傳了文件在同一個谷歌網站頁面,並使用該文件的下載鏈接作爲添加小工具對話框中的URL。我得到了以下錯誤。
您添加的小工具無效
不支持的功能:org.apache.shindig.common.xml.XmlException:本 參考實體「HL」必須結束「;」分隔符。在(34,97)
我不明白的問題here.There是在代碼中沒有實體「HL」除了在鏈接到電子表格中,我已經正確連接,因爲據我所知。 如何解決這個問題?
我對HTML/Javascript很新。我做了谷歌搜索的問題,但找不到相同的問題。很多其他的錯誤情況都有一些服務器錯誤。
下面的代碼:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Database Search" />
<Content type="html">
<html>
<head>
<title>Example of Google Spreadsheet Data Visualisation</title>
</head>
<body>
<form id="form1" method="post" > <label>
<input id="search" name="search" type="text" />
</label>
<label>
<input type="submit" />
</label>
</form>
<p>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['table']});
</script>
<script type="text/javascript">
var visualization;
function drawVisualization() {
var query = new google.visualization.Query(
'http://spreadsheets.google.com/tq?key=0Au0WkOi_oKm0dDNwYkUxRkRqUzVKa1ZEWnFyYXpnaWc&hl=en_GB');
query.setQuery('SELECT A, B, C where upper(A) like upper("%<?php echo $search; ?>%") or upper(B) like upper("%<?php echo $search; ?>%") order by A asc label A "Type", B "Title", C "Date added"');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
visualization = new google.visualization.Table(document.getElementById('table'));
visualization.draw(data, {legend: 'bottom'});
}
google.setOnLoadCallback(drawVisualization);
</script>
<div id="table"></div>
</div>
</body>
</html>
</Content>
</Module>