Page 1 of 1

docx4j 3.3.2 beta - please test!

PostPosted: Mon Nov 21, 2016 7:07 pm
by jason
A beta of v3.3.2 is now available. The release itself is scheduled for the week before Christmas.

Get it at http://www.docx4java.org/docx4j/docx4j-3.3.2-beta.jar

Please try it to verify it works for you! To leave feedback, just reply or start a new thread, thanks.

This release fixes various bugs, including:
- fix for OpenDoPE complex conditions (broken by 3.3.1)
- fix for IllegalArgumentException: local part cannot be "null" when creating a QName

It also introduces JAXBXmlPart "pipe" methods, which enable you to process your content using StAX (or SAX). You can use it with or without JAXB. If you don't use any JAXB functionality on a part, you avoid JAXB overhead (most useful for very large files); see VariableReplaceStAX for an example

Re: docx4j 3.3.2 beta - please test!

PostPosted: Tue Nov 29, 2016 9:26 pm
by Kekwel
Hi Jason,

I downloaded the beta jar, and wanted to try the VariableReplaceStAX sample on your GitHub (https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/VariableReplaceStAX.java)

Unfortunately, I've got an exception :
Code: Select all
Exception in thread "main" javax.xml.stream.XMLStreamException: Underlying stream encoding 'Cp1252' and input paramter for writeStartDocument() method 'UTF-8' do not match.
   at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeStartDocument(XMLStreamWriterImpl.java:1191)
   at org.docx4j.openpackaging.parts.StAXHandlerAbstract.write(StAXHandlerAbstract.java:102)
   at org.docx4j.openpackaging.parts.StAXHandlerAbstract.handle(StAXHandlerAbstract.java:25)
   at org.docx4j.openpackaging.parts.JaxbXmlPart.pipe(JaxbXmlPart.java:452)
   at org.docx4j.openpackaging.parts.JaxbXmlPart.pipe(JaxbXmlPart.java:373)
   at testDocx4j.VariableReplaceStAX.main(VariableReplaceStAX.java:46)


Did I do something wrong ? Or forgot something ?
I put my docx test in attachment, if it can help to understand

Re: docx4j 3.3.2 beta - please test!

PostPosted: Wed Nov 30, 2016 5:10 pm
by jason
Thanks for the report!

I wonder which StAX implementation you are using?

Please try http://www.docx4java.org/docx4j/docx4j- ... 161130.jar

Let me know whether that fixes the problem. Thanks :-)

Re: docx4j 3.3.2 beta - please test!

PostPosted: Wed Nov 30, 2016 9:10 pm
by Kekwel
Hi !

I tried again with your last jar and work perfectly ! Problem fixed :)

But I have another one infortunatly .. I tried to implement it on project where we already use variable replacement, etc.
And I've got this one :
Code: Select all
java.lang.ClassCastException: java.lang.String cannot be cast to javax.xml.stream.XMLReporter
   at com.ctc.wstx.api.ReaderConfig.setProperty(ReaderConfig.java:1492) ~[woodstox-core-asl-4.4.1.jar:4.4.1]
   at com.ctc.wstx.api.CommonConfig.setProperty(CommonConfig.java:155) ~[woodstox-core-asl-4.4.1.jar:4.4.1]
   at com.ctc.wstx.stax.WstxInputFactory.setProperty(WstxInputFactory.java:383) ~[woodstox-core-asl-4.4.1.jar:4.4.1]
   at org.docx4j.openpackaging.parts.JaxbXmlPart.pipe(JaxbXmlPart.java:399) ~[docx4j-3.3.2-beta2.jar:na]
   at org.docx4j.openpackaging.parts.JaxbXmlPart.pipe(JaxbXmlPart.java:375) ~[docx4j-3.3.2-beta2.jar:na]
   at fr.univlorraine.calcium2k16.services.EditionService.variableCorpsStax(EditionService.java:1694) ~[classes/:na]
   ...


And here's how I call the pipe method
Code: Select all
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
documentPart.pipe(new MyStAXHandler(map));


I don't know, what you mean by StAX implementation ?

Thanks for the rapidity btw !

Re: docx4j 3.3.2 beta - please test!

PostPosted: Wed Dec 14, 2016 7:17 pm
by Kekwel
Hi Jason,

Did you understand my problem ? Or maybe it was something I'm missing ?

Re: docx4j 3.3.2 beta - please test!

PostPosted: Fri Dec 16, 2016 7:27 pm
by jason
Sorry I didn't notice your complete post - I just saw the first line!

woodstox is your stax implementation; I can see from the stacktrace.

Please try http://www.docx4java.org/docx4j/docx4j- ... 161216.jar which contains https://github.com/plutext/docx4j/commi ... 755307ed58