我遇到了一个非常令人沮丧的错误。这在周五没有问题,我昨晚部署了它,今天发现修改后的时间戳没有正确格式化为 iso8690(消化提要的应用程序非常严格)所以我重新格式化它并构建了一个 jar 用于测试。出现此错误:
05110009 Failed to execute script 'classpath*:alfresco/site-webscripts/org/foo/components/dashlets/recent-docs.get.js': 05110008 SyntaxError: illegally formed XML syntax (jar:file:/usr/share/tomcat6/shared/lib/recent-docs.jar!/alfresco/site-webscripts/org/foo/components/dashlets/recent-docs.get.js#20(eval)#1)
所以我恢复更改并显示完全相同的错误。谁能告诉我为什么我会收到这个?我什至将原来的 jar 复制回来,同样的错误。
以下是 repo webscript 生成的 JSON 输出示例:
{
"documents":
[
{
"site": "swsdp",
"nodeRef": "workspace://SpacesStore/1a0b110f-1e09-4ca2-b367-fe25e4964a4e",
"id": "1a0b110f-1e09-4ca2-b367-fe25e4964a4e",
"name": "Project Contract.pdf",
"title": "Project Contract for Green Enery",
"creator": "abeecher",
"description": "Conract for the Green Energy project",
"categories": [
],
"created": "15 Feb 2011 21:26:54 PM (UTC)",
"modified": "14 Jun 2011 10:28:54 AM (UTC)"
},
{
"site": "swsdp",
"nodeRef": "workspace://SpacesStore/05dedd34-9d9d-48d9-9af6-c81b555541c9",
"id": "05dedd34-9d9d-48d9-9af6-c81b555541c9",
"name": "WebSiteReview.mp4",
"title": "WebSiteReview.mp4",
"creator": "abeecher",
"description": "This is a video of the mock up to show the planned structure for the new web site.",
"categories": [
],
"created": "08 Mar 2011 10:35:10 AM (UTC)",
"modified": "08 Mar 2011 10:37:43 AM (UTC)"
}
]
}
和分享网页脚本的东西
recent-docs.get.desc.xml
<shortname>Recently Modified Documents</shortname>
<description>Retrieve Recently Modified content for a site</description>
<url>/components/recent-docs?site={site}</url>
<arg>
<shortname>site</shortname>
<description><![CDATA[site name]]></description>
</arg>
<format default="html">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
<cache>
<neverCache>false</neverCache>
<mustRevalidate/>
</cache>
</webscript>
recent-docs.get.js
function main()
{
for (var arg in args)
{
if (arg == "site")
{
model.site = args[arg];
}
}
// call the repository to get recent documents
var connector = remote.connect("alfresco");
var json = connector.call("/recent-docs?site=" + escape(model.site));
if (json.status == 200)
{
obj = eval("(" + json + ")");
model.docs = obj["documents"];
}
else
{
obj = eval("(" + json + ")");
obj.name = "Error";
model.docs = obj;
}
}
main();
recent-docs.get.atom.ftl
<feed xmlns="http://www.w3.org/2005/Atom">
<generator version="${server.version}">Alfresco (${server.edition})</generator>
<link rel="self" href="${absurl(url.full)?xml}" />
<id>${absurl(url.full)?xml}</id>
<title>Site: ${site}</title>
<subtitle>Alfresco Recently Modified Documents</subtitle>
<updated>${xmldate(date)}</updated>
<icon>${absurl(url.context)}/res/themes/default/images/app-logo-48.png</icon>
<#list docs as child>
<entry xmlns='http://www.w3.org/2005/Atom'>
<title>${child.name?html}</title>
<link href="${absurl(url.context)}/page/document-details?nodeRef=${child.nodeRef}"/>
<id>urn:uuid:${child.id}</id>
<updated>${child.modified}</updated>
<summary>
${msg("feed.uploaded", child.name, child.creator)}<br />
<#if child.modifier?exists>${msg("feed.modified", child.modified, child.modifier)}<br /></#if>
${child.description!""}<br />
<#if child.categories[0]?exists>
${msg("feed.categories")} <#list child.categories as category> ${category.name}<#if category_has_next>, </#if></#list></#if><br />
</summary>
<author>
<name>${child.creator}</name>
</author>
</entry>
</#list>
</feed>
我一直在尝试各种尝试但没有成功,我已经进行了一组更改来更正 atom 模板,因此它是有效的 atom 文档,但我需要弄清楚为什么会出现此错误。我认为这是因为我没有将所有内容都转换为 repo webscript 中的字符串(仅修改/创建时间),但尚不清楚我应该如何准备它。
更新我修改了 atom 模板以在 repo 端运行,结果是 XML 有效,所以至少这是有效的。在共享方面,我仍然看到语法错误,这是有问题的,因为我打算用它来构建一个 dashlet。