cancel
Showing results for 
Search instead for 
Did you mean: 

RSS-Feed with versionLabel of the content

schneika
Champ in-the-making
Champ in-the-making
I want to apply the versionLabels of documents to my RSS-Feed.
I use this Freemarker-Template:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>QMS-Manual RSS-Feed</title>
      <copyright>Copyright © KGS 2007 </copyright>
      <#assign hostname="http://hostname:8080/alfresco">
      <#assign spaceref="${hostname}/navigate/browse/${space.nodeRef.storeRef.protocol}/${space.nodeRef.storeRef.identifier}/${space.nodeRef.id}">
      <#assign datetimeformat="EEE, dd MMM yyyy HH:mm:ss zzz">
      <link>${spaceref}</link>
      <description>Aktualisierte Inhalte im '${space.name}'</description>
      <language>de-de</language>
      <lastBuildDate>${date?string(datetimeformat)}</lastBuildDate>
      <pubDate>${date?string(datetimeformat)}</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 2.1.1</generator>
      <image>
         <title>${space.name}</title>
         <width>64</width>
         <height>64</height>
         <link>${spaceref}</link>
         <url>${hostname}${space.icon32}</url>
      </image>
      <#assign weekms=1000*60*60*24*7>
      <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if (dateCompare(child.properties["cm:modified"], date, weekms) == 1) || (dateCompare(child.properties["cm:created"], date, weekms) == 1)>
      <item>
         <title>${child.properties.name}</title>
         <link>${hostname}${child.url}</link>
         <description>
            ${"<a href='${hostname}${child.url}'>"?xml}${child.properties.name}${"</a>"?xml}
            <#if child.properties["cm:description"]?exists && child.properties["cm:description"] != "">
               ${child.properties["cm:description"]}
            </#if>
          <modifier>geändert von ${child.properties["cm:modifier"]}</modifier>

          <versionLabel>Version ${document.versionHistory.versionLabel}</versionLabel>
       </description>
            <pubDate>${child.properties["cm:modified"]?string(datetimeformat)}</pubDate>
            <guid isPermaLink="false">${hostname}${child.url}</guid>
      </item>
      </#if>
      </#list>
   </channel>
</rss>

But during processing the template with document.versionHistory… i got this error:

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
freemarker.template.TemplateException: Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:264)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet$TemplateContentWork.doWork(GuestTemplateContentServlet.java:191)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet.service(GuestTemplateContentServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:204)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:177)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:107)
at sun.reflect.GeneratedMethodAccessor1712.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy106.processTemplate(Unknown Source)
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:234)
… 18 more
Caused by: freemarker.template.TemplateException: Expected hash. document.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 35, column 35 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:172)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:200)

Please can you tell me, where is my logical Problem?   :?
10 REPLIES 10

mikeh
Star Contributor
Star Contributor
Hi

I think you meant to write child.versionHistory…

Thanks,
Mike

schneika
Champ in-the-making
Champ in-the-making
Now with

<versionLabel>Version ${child.versionHistory.versionLabel}</versionLabel> 

i get this error:

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
freemarker.template.TemplateException: Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:264)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet$TemplateContentWork.doWork(GuestTemplateContentServlet.java:191)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet.service(GuestTemplateContentServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:204)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:177)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:107)
at sun.reflect.GeneratedMethodAccessor1712.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy106.processTemplate(Unknown Source)
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:234)
… 18 more
Caused by: freemarker.template.TemplateException: Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 36 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:172)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:200)
… 39 more

mikeh
Star Contributor
Star Contributor
Does each document definitely have a version history?

It might be worth wrapping that part with:
<#if hasAspect(child, "cm:versionable") == 1>

</#if>

Thanks,
Mike

schneika
Champ in-the-making
Champ in-the-making
Thanx for reply!
In my RSS-Feed:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>QMS-Handbuch RSS-Feed</title>
      <copyright>Copyright © KGS 2007</copyright>
      <#assign hostname="http://hostname:8080/alfresco">
      <#assign spaceref="${hostname}/navigate/browse/${space.nodeRef.storeRef.protocol}/${space.nodeRef.storeRef.identifier}/${space.nodeRef.id}">
      <#assign datetimeformat="EEE, dd MMM yyyy HH:mm:ss zzz">
      <link>${spaceref}</link>
      <description>Aktualisierte Inhalte im '${space.name}'</description>
      <language>de-de</language>
      <lastBuildDate>${date?string(datetimeformat)}</lastBuildDate>
      <pubDate>${date?string(datetimeformat)}</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 2.1.1</generator>
      <image>
         <title>${space.name}</title>
         <width>64</width>
         <height>64</height>
         <link>${spaceref}</link>
         <url>${hostname}${space.icon32}</url>
      </image>
      <#assign weekms=1000*60*60*24*7>
      <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if (dateCompare(child.properties["cm:modified"], date, weekms) == 1) || (dateCompare(child.properties["cm:created"], date, weekms) == 1)>
      <item>
         <title>${child.properties.name}</title>
         <link>${hostname}${child.url}</link>
         <description>
            ${"<a href='${hostname}${child.url}'>"?xml}${child.properties.name}${"</a>"?xml}
            <#if child.properties["cm:description"]?exists && child.properties["cm:description"] != "">
               ${child.properties["cm:description"]}
            </#if>
            <#if hasAspect(child, "cm:versionable") == 1> ${child.versionHistory.versionLabel}
            </#if>
           <modifier>geändert von ${child.properties["cm:modifier"]}</modifier>
       </description>
            <pubDate>${child.properties["cm:modified"]?string(datetimeformat)}</pubDate>
            <guid isPermaLink="false">${hostname}${child.url}</guid>
      </item>
      </#if>
      </#list> </channel>
</rss>

now i have tried this wrap:

<#if hasAspect(child, "cm:versionable") == 1> ${child.versionHistory.versionLabel}
            </#if>

and this wrap:

<#if hasAspect(child, "cm:versionable") == 1>
     <versionLabel>Version ${child.versionHistory.versionLabel}</versionLabel>
  </#if>

Without success:

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
caused by:
freemarker.template.TemplateException: Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:264)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet$TemplateContentWork.doWork(GuestTemplateContentServlet.java:191)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
at org.alfresco.web.app.servlet.GuestTemplateContentServlet.service(GuestTemplateContentServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke………………….at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.repository.TemplateException: Fehler während der Verarbeitung der Vorlage "Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.". Bitte kontaktieren Sie Ihren System-Administrator.
at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:204)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:177)
at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:107)
at sun.reflect.GeneratedMethodAccessor1712.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at ………………………………………at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy106.processTemplate(Unknown Source)
at org.alfresco.web.app.servlet.BaseTemplateContentServlet.processTemplateRequest(BaseTemplateContentServlet.java:234)
… 18 more
Caused by: freemarker.template.TemplateException: Expected hash. child.versionHistory evaluated instead to freemarker.template.SimpleSequence on line 34, column 61 in workspace://SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
at freemarker.core.DynamicKeyName.dealWithStringKey(DynamicKeyName.java:138)
at freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:94)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)

:cry:

mikeh
Star Contributor
Star Contributor
Sorry, my fault. I forgot that versionHistory returns an array, so you have to use something like:
<versionLabel>Version ${child.versionHistory?sort_by("versionLabel")?reverse[0].versionLabel}</versionLabel>
to get the most recent version.

Thanks,
Mike

schneika
Champ in-the-making
Champ in-the-making
Thanx very much, a very useful tip! now i understand moch more.
But perhaps can you help me once more.
Because now the feed can not be displayed in the browser, i get the Feed-Error:

"The following tags wouldnt be closed: rss, channel, item, description, versionLabel"

This is my actual RSS-Template:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>VSA ApothekenSysteme GmbH QMS-Handbuch RSS-Feed</title>
      <copyright>Copyright © KGS 2007 VSA ApothekenSysteme GmbH</copyright>
      <#assign hostname="http://spdms01-1:8080/alfresco">
      <#assign spaceref="${hostname}/navigate/browse/${space.nodeRef.storeRef.protocol}/${space.nodeRef.storeRef.identifier}/${space.nodeRef.id}">
      <#assign datetimeformat="EEE, dd MMM yyyy HH:mm:ss zzz">
      <link>${spaceref}</link>
      <description>Aktualisierte Inhalte im '${space.name}'</description>
      <language>de-de</language>
      <lastBuildDate>${date?string(datetimeformat)}</lastBuildDate>
      <pubDate>${date?string(datetimeformat)}</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 2.1.1</generator>
      <image>
         <title>${space.name}</title>
         <width>64</width>
         <height>64</height>
         <link>${spaceref}</link>
         <url>${hostname}${space.icon32}</url>
      </image>
      <#assign weekms=1000*60*60*24*7>
      <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if (dateCompare(child.properties["cm:modified"], date, weekms) == 1) || (dateCompare(child.properties["cm:created"], date, weekms) == 1)>
      <item>
         <title>${child.properties.name}</title>
         <link>${hostname}${child.url}</link>
         <description>
          
              ${"<a href='${hostname}${child.url}'>"?xml}${child.properties.name}${"</a>"?xml}
            
                    <#if child.properties["cm:description"]?exists && child.properties["cm:description"] != ""> ${child.properties["cm:description"]}
               </#if>

               <#if hasAspect(child, "cm:versionable") == 1>
               <versionLabel>Version ${child.versionHistory?sort_by("versionLabel")?reverse[0].versionLabel}</versionLabel>
               </#if>
                           
                <modifier>geändert von ${child.properties["cm:modifier"]}</modifier>

            </description>
            <pubDate>${child.properties["cm:modified"]?string(datetimeformat)}</pubDate>
            <guid isPermaLink="false">${hostname}${child.url}</guid>
      </item>
      </#if>
      </#list>
   </channel>
</rss>

mikeh
Star Contributor
Star Contributor
Nothing obviously wrong after a first look, although it might be easier to see if you could post the XML output that produces the error.

Thanks,
Mike

schneika
Champ in-the-making
Champ in-the-making
Here is some sourcecode from the xml out of IE7:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
   <channel>
      <title>QMS-Handbuch RSS-Feed</title>
      <copyright>Copyright © KGS 2007</copyright>
            <link>http://spdms01-1:8080/alfresco/navigate/browse/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081...</link>
      <description>Aktualisierte Inhalte im 'QMS-Handbuch'</description>
      <language>de-de</language>
      <lastBuildDate>Fr, 28 Sep 2007 18:09:08 CEST</lastBuildDate>
      <pubDate>Fr, 28 Sep 2007 18:09:08 CEST</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 2.1.1</generator>
      <image>
         <title>QMS-Handbuch</title>
         <width>64</width>
         <height>64</height>
         <link>http://spdms01-1:8080/alfresco/navigate/browse/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081...</link>
         <url>http://spdms01-1:8080/alfresco/images/icons/space-icon-star.gif</url>
      </image>
      <item>
         <title>PB VAD Kontaktaufnahme.xls</title>
         <link>http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/e74f8301-1ab6-11dc-bb7c-2bb571602a48/PB%20V...</link>
         <description>
          
              &lt;a href=&apos;http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/e74f8301-1ab6-11dc-bb7c-2bb571602a48/PB%20V... VAD Kontaktaufnahme.xls&lt;/a&gt;
            
                     Prozessbeschreibung
               <versionLabel>Version 1.2</versionLabel>

                                         
                <modifier>geändert von scheltan</modifier>

            </description>
            <pubDate>Mo, 24 Sep 2007 16:02:33 CEST</pubDate>
            <guid isPermaLink="false">http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/e74f8301-1ab6-11dc-bb7c-2bb571602a48/PB%20V...</guid>
      </item>
      <item>
         <title>AA Installations-Checkliste PS-Techniker.doc</title>
         <link>http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/a27f2a78-6c18-11dc-b8a8-ab770b6e9f06/AA%20I...</link>
         <description>
          
              &lt;a href=&apos;http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/a27f2a78-6c18-11dc-b8a8-ab770b6e9f06/AA%20I... Installations-Checkliste PS-Techniker.doc&lt;/a&gt;
            
                                   <versionLabel>Version 1.0</versionLabel>

                                         
                <modifier>geändert von scheltan</modifier>

            </description>
            <pubDate>Mi, 26 Sep 2007 13:44:24 CEST</pubDate>
            <guid isPermaLink="false">http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/a27f2a78-6c18-11dc-b8a8-ab770b6e9f06/AA%20I...</guid>
      </item>
      <item>
         <title>MD Checkliste zum Versenden von Faxen per Outlook an Kunden.doc</title>
         <link>http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/556ebda8-6c01-11dc-b8a8-ab770b6e9f06/MD%20C...</link>
         <description>
          
              &lt;a href=&apos;http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/556ebda8-6c01-11dc-b8a8-ab770b6e9f06/MD%20C... Checkliste zum Versenden von Faxen per Outlook an Kunden.doc&lt;/a&gt;
            
                                   <versionLabel>Version 1.0</versionLabel>

                                         
                <modifier>geändert von scheltan</modifier>

            </description>
            <pubDate>Mi, 26 Sep 2007 09:37:56 CEST</pubDate>
            <guid isPermaLink="false">http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/556ebda8-6c01-11dc-b8a8-ab770b6e9f06/MD%20C...</guid>
      </item>
      <item>
         <title>MD W2Kx Systempasswort Anlagenchef.pdf</title>
         <link>http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/660fd4db-4c15-11dc-a6c3-3d560e53283c/MD%20W...</link>
         <description>
          
              &lt;a href=&apos;http://spdms01-1:8080/alfresco/d/d/workspace/SpacesStore/660fd4db-4c15-11dc-a6c3-3d560e53283c/MD%20W... W2Kx Systempasswort Anlagenchef.pdf&lt;/a&gt;
            
                                   <versionLabel>Version 1.0</versionLabel>

                                         
              …………………………………………………………………………

This is the html-header of the feed

http://spdms01-1:8080/alfresco/guestTemplate/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081f7...

GET /alfresco/guestTemplate/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081f7bf4/workspace/SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4/rss.xml?mimetype=text%2Fxml HTTP/1.1
Host: spdms01-1:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://spdms01-1:8080/alfresco/navigate/browse/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081...
Cookie: JSESSIONID=AE4E6C680C7017885A896AEB996D2BE1

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Fri, 28 Sep 2007 16:13:26 GMT
———————————————————-
http://spdms01-1:8080/alfresco/guestTemplate/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081f7...

GET /alfresco/guestTemplate/workspace/SpacesStore/b0bb598d-fe23-11db-a1d8-67c5081f7bf4/workspace/SpacesStore/73a185eb-0791-11dc-83a7-a1f550e0d9b4/rss.xml?mimetype=text%2Fxml HTTP/1.1
Host: spdms01-1:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
X-Moz: livebookmarks
Cookie: JSESSIONID=AE4E6C680C7017885A896AEB996D2BE1
Cache-Control: max-age=0

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Fri, 28 Sep 2007 16:13:33 GMT
———————————————————-

But the feed cant be displayed either in IE7 nor Firefox 2

mikeh
Star Contributor
Star Contributor
I tried the first three <item>s in that feed and they displayed fine in both MSIE 7 and Firefox 2, so the problem must lie further down the RSS output.

Your best option is to save the full XML into the Tomcat ROOT web app, cut out all the <item> nodes and add them back in one by one, each time refreshing the output in a web browser until you find the problem area.

It's likely to be some string not being encoded as XML, which should be simple to fix.

Thanks,
Mike