AnsweredAssumed Answered

Expecting a string, date or number here, Expression ..

Question asked by cirruslogic on Aug 25, 2010
I have an XML file deposited in a <user home> <vendor id> <orders>
I want the user to view the contents presented in various formats.
I created this simple ftl file to test this but I am getting this error.
There is already a value in the element uniqueCreatorIdentification but it seems like it is not reading that value.
———————————————————————————
Caused by: freemarker.core.NonStringException: Error on line 4, column 11 in workspace://SpacesStore/cb640b3c-37f5-4f54-9347-dcfc8fe72dd9
Expecting a string, date or number here, Expression dom.order.typedEntityIdentification.entityIdentification.uniqueCreatorIdentification is instead a freemarker.ext.dom.NodeListModel
   at freemarker.core.Expression.getStringValue(Expression.java:126)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
———————————————————————————
This is my test xml file:
<?xml version="1.0" encoding="UTF-8"?>
<test:order xmlns:test="http://www.test.org/schemas/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" documentStatus="COPY" creationDate="2010-07-24T00:00:00" >
  <typedEntityIdentification entityType="ORDER">
    <entityIdentification>
      <uniqueCreatorIdentification>12328434</uniqueCreatorIdentification>
    </entityIdentification>
     </typedEntityIdentification>
</test:order>
This is my ftl  file:
<#ftl ns_prefixes={"test", "http://www.test.org/schemas/test"}>
<#if document.mimetype = "text/xml">
  <#assign dom=document.xmlNodeModel>
    <h1>${dom.order.typedEntityIdentification.entityIdentification.uniqueCreatorIdentification}</h1>
</#if>
———————————————————————————

Outcomes