vs72737 / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

Conditional on node attribute throws exception #404

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use xml context
2. try a freemarker conditional in docx file on attribute of node [#if 
r.@interview=1]
3. run DocxXMLProjectWithFreemarkerList sample with xml as input

What is the expected output? What do you see instead?
I expect to do have conditional template content.
The following exception is thrown:

FreeMarker template error:
Can't compare values of these types. Allowed comparisons are between two 
numbers, two strings, two dates, or two booleans.
Left hand operand is a node+sequence+hash+string 
(com.sun.org.apache.xerces.internal.dom.DeferredAttrNSImpl wrapped into 
f.e.dom.AttributeNodeModel).
Right hand operand is a number (wrapper: f.t.SimpleNumber).
The blamed expression:
==> r.@interview=1  [in template 
"fr.opensagres.xdocreport.document.docx.DocxReport@1ff6c2a9!word/document.xml" 
at line 4, column 5838]

The failing instruction (FTL stack trace):
----------
==> #if r.@interview = 1  [in template 
"fr.opensagres.xdocreport.document.docx.DocxReport@1ff6c2a9!word/document.xml" 
at line 4, column 5833]
----------

Java stack trace (for programmers):
----------
freemarker.core._MiscTemplateException: [... Exception message was already 
printed; see it above ...]
    at freemarker.core.EvalUtil.compare(EvalUtil.java:335)
    at freemarker.core.EvalUtil.compare(EvalUtil.java:148)
    at freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:103)
    at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:84)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
    at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.EscapeBlock.accept(EscapeBlock.java:85)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.Environment.process(Environment.java:243)
    at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.process(FreemarkerTemplateEngine.java:162)
    at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:112)
    at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:111)
    at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:83)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:775)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:521)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:487)
    at xmlbinder.agendacreator.main(agendacreator.java:64)

What version of the product are you using? On what operating system?
xdocreport 1.0.4
freemarker 2.3.20

Please provide any additional information below.

Original issue reported on code.google.com by mjawurek@gmail.com on 4 Jun 2014 at 12:51

GoogleCodeExporter commented 8 years ago
It seems that it's a problem with Freemarker and XML context. Have you tried 
teh same test with a simple template text file and Freemarker (without 
XDocReport).

I suggest you that you do that. If you have problem again, please post your 
question on Freemarker forum. If you have not a problem with simple template 
file (without XDocReport) but problem with XDocReport, I will study your 
problem.

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 Jun 2014 at 12:59

GoogleCodeExporter commented 8 years ago
None answer, I close this issue.

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 3:51

GoogleCodeExporter commented 8 years ago
cleanup

Original comment by pascal.leclercq on 10 Oct 2014 at 7:37