我正尝试在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>