Page 1 of 1

Can not convert #BOOLEAN to a NodeList!

PostPosted: Wed Jan 04, 2017 10:21 pm
by klausT
Hi,

For this xpath expression
Code: Select all
<xpath id="EtFsy">
      <dataBinding xpath="string-length(/Template[1]/SLD[1]/BusinessSystems[1]/BusinessSystem[1]/Products[1]/Product[1]/Vendor[1])&gt;0" storeItemID="{B981C26E-07CC-4E04-8DB5-6381C1213442}"/>
   </xpath>


I get the error message
Can not convert #BOOLEAN to a NodeList!


In your source code https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/openpackaging/parts/XmlPart.java at line 190 you are dealing with this kind of issue but it seems as string-length is not handled correctly.

Would be great if you could have a look at this.

Thanks,
Klaus

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Thu Jan 05, 2017 9:55 am
by jason
Hi Klaus

Is this system using docx4j v3.3.2, or something older? Did you get a stack trace?

I added the test case https://github.com/plutext/docx4j/commi ... c02df22ef8 but it seems OK already.

cheers .. Jason

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Fri Jan 06, 2017 2:09 am
by klausT
Hi Jason,

We are using docx4j nighty build from 20161130.
So, not a really old version.

One challenge is that I can't reproduce the issue on my side.
But as one of our customers reports this issue there must be a dependency.
Maybe on the Java version, regional setttings, language...
The customer uses Java 1.8.0_74 whereas I use version 1.8.101. All on Windows 7, 64 Bit.

Here is the Stacktrace from the customer:
03.Januar.2017 12:40:26 688904 ERROR [Docx_Generator_iFlow_IF_ZFA_ZE99_STEP2] org.docx4j.model.datastorage.BindingHandler (xpathGetString:339) - Exception executing string-length(/Template[1]/SLD[1]/BusinessSystems[1]/BusinessSystem[1][1]/Products[1]/Product[1][1]/Vendor[1])>0
org.docx4j.openpackaging.exceptions.Docx4JException: Exception executing string-length(/Template[1]/SLD[1]/BusinessSystems[1]/BusinessSystem[1][1]/Products[1]/Product[1][1]/Vendor[1])>0
at org.docx4j.openpackaging.parts.XmlPart.cachedXPathGetString(XmlPart.java:310)
at org.docx4j.openpackaging.parts.CustomXmlDataStoragePart.cachedXPathGetString(CustomXmlDataStoragePart.java:169)
at org.docx4j.model.datastorage.BindingHandler.xpathGetString(BindingHandler.java:323)
at org.opendope.conditions.Xpathref.evaluate(Xpathref.java:87)
at org.opendope.conditions.Condition.evaluate(Condition.java:125)
at org.docx4j.model.datastorage.OpenDoPEHandler.processBindingRoleIfAny(OpenDoPEHandler.java:798)
at org.docx4j.model.datastorage.OpenDoPEHandler.access$100(OpenDoPEHandler.java:81)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.apply(OpenDoPEHandler.java:668)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:714)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:730)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:730)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:730)
at org.docx4j.model.datastorage.OpenDoPEHandler$ShallowTraversor.walkJAXBElements(OpenDoPEHandler.java:730)
at org.docx4j.TraversalUtil.<init>(TraversalUtil.java:214)
at org.docx4j.model.datastorage.OpenDoPEHandler.preprocess(OpenDoPEHandler.java:277)
at com.arianim.swingworker.com8.run(DocxGenerator.java:216)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.xpath.XPathException: #BOOLEAN kann nicht in NodeList konvertiert werden!
at org.apache.xpath.objects.XObject.error(XObject.java:709)
at org.apache.xpath.objects.XObject.nodeset(XObject.java:439)
at org.docx4j.openpackaging.parts.XmlPart.selectNodeIterator(XmlPart.java:427)
at org.docx4j.openpackaging.parts.XmlPart.selectSingleNode(XmlPart.java:400)
at org.docx4j.openpackaging.parts.XmlPart.cachedXPathGetString(XmlPart.java:269)
... 16 more


If it helps to reproduce the problem, I can also sent you the corresponding xml file plus the Docx template.

Regards,
Klaus

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Fri Jan 06, 2017 9:42 am
by jason
Turns out to be a language issue; Fixed by https://github.com/plutext/docx4j/commi ... df0b91d097

Will be in a nightly build later today.

cheers .. Jason

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Fri Jan 06, 2017 4:49 pm
by jason

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Sat Jan 14, 2017 9:02 am
by klausT
The fix is working fine

Re: Can not convert #BOOLEAN to a NodeList!

PostPosted: Tue Feb 07, 2017 6:04 pm
by jason
This fix is in docx4j 3.3.3, now available.