AnsweredAssumed Answered

xml parse exception.........

Question asked by spillai on Jan 5, 2008
Latest reply on Jul 22, 2008 by harmaildhiman
hi,

I am trying to process a xml document like the one given below,

  <?xml version="1.0" encoding="UTF-8" ?>
  <mstns:CommonQuestion xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:alf="http://www.alfresco.org" xmlns:chiba="http://chiba.sourceforge.net/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <mstns:Question>this is question 1<br /></mstns:Question>
  <mstns:Answer>this is answer 1</mstns:Answer>
  <mstns:Keywords>key1 key2 key3</mstns:Keywords>
  </mstns:CommonQuestion>

with the template file as given below :

<#ftl ns_prefixes={"mstns":"http://tempuri.org/XMLSchema.xsd"}>
<table>
<#list resultset as node>
     <tr>
         <td><#if node.mimetype ="text/xml">
                     <#assign dom=node.xmlNodeModel>
                                 ${.vars["mstns:CommonQuestion/mstns:Question"]}
                 </#if>
     </tr>
</#list>
</table>


using the reference from : http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Simple_examples_using_Freemarker_templates
and the post on forum at : http://forums.alfresco.com/viewtopic.php?t=8974&highlight=parseexception


but on execution of the webscript it throws the following error:

Message:   Error during processing of the template 'Expression .vars["mstns:CommonQuestion/mstns:Question"] is undefined on line 7, column 36 in com/medicalert/XmlFileFinder/xmlFileSearcher.get.html.ftl.'. Please contact your system administrator.

Exception:   freemarker.core.InvalidReferenceException - Expression .vars["mstns:CommonQuestion/mstns:Question"] is undefined on line 7, column 36 in com/medicalert/XmlFileFinder/xmlFileSearcher.get.html.ftl.
   
           freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
           freemarker.core.Expression.getStringValue(Expression.java:118)


Please help me out……..

Sujay Pillai

Outcomes