Page 1 of 1

line 201: Variable 'pPrNode' is multiply defined in the same

PostPosted: Wed Mar 19, 2014 5:33 am
by AndersG
G'day! Phew, that registration question was tricky for a non-english speaker :)

Similar to http://stackoverflow.com/questions/1846 ... -with-list

I am testing out converting doxc to HTML. Ultimate goal is to render docx files. I compiled the commandline sample and tried converting just one file, to get a hang of it all. With the shipping 3.0.1 jar it renders the file and then errors out with:


Code: Select all
Exception in thread "main" org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
        at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:89)
        at org.docx4j.Docx4J.toHTML(Docx4J.java:470)
        at org.docx4j.samples.ConvertOutHtml.main(ConvertOutHtml.java:113)
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Exception loading template "org/docx4j/convert/out/html/docx2xhtml.xslt", line 201: Variable 'pPrNode' is multiply defined in the same scope.


When I try the same with the nightly build, it errors out immediately with the same error. The commandline I use is:
Code: Select all
java -cp .:docx4j-3.0.1.jar:dependencies/log4j-1.2.17.jar:dependencies/slf4j-api-1.7.5.jar:dependencies/slf4j-log4j12-1.7.5.jar:dependencies/commons-io-1.3.1.jar:xmlgraphics-commons-1.5.jar org.docx4j.samples.ConvertOutHtml ff-1923-12.docx >test.html


I have attached the document. Nothing fancy. It was a plain doc that was saved as docx from Word 2013. The main goal is to use Word2013 as editor for all new files and keep files in ooxml and then just render them for the web as needed.

Thanks in advance.

Re: line 201: Variable 'pPrNode' is multiply defined in the

PostPosted: Wed Mar 19, 2014 7:47 am
by jason
For what its worth, I don't get that error when I run your file through ConvertOutHtml in my IDE (Eclipse).

You don't have xalan on your classpath. That could well be the problem.

Re: line 201: Variable 'pPrNode' is multiply defined in the

PostPosted: Wed Mar 19, 2014 7:33 pm
by AndersG
Yes, it was xalan and serializer that were missing. I was going to write "proper" code later, but for now, I just wanted a feel for how the converted output from these particular docx files looked like.

After adding xalan and serializer it runs, but inserts the following in the output:
TO HIDE THESE MESSAGES, TURN OFF debug level logging for org.docx4j.convert.out.common.writer.AbstractMessageWriter

I tried to do so, by adding a log4j.xml, but that just threw an error:
ERROR org.docx4j.jaxb.Context .<clinit> line 166 - Cannot initialize context
javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index
- with linked exception:
[javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index]

Re: line 201: Variable 'pPrNode' is multiply defined in the

PostPosted: Wed Mar 19, 2014 8:10 pm
by jason
Have you added the log4j jar?

AndersG wrote:ERROR org.docx4j.jaxb.Context .<clinit> line 166 - Cannot initialize context
javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index
- with linked exception:
[javax.xml.bind.JAXBException: "org.plutext.jaxb.xmldsig" doesnt contain ObjectFactory.class or jaxb.index]


That's not related to log4j. That's because you don't have http://www.docx4java.org/docx4j/docx4j- ... -1.0.0.jar

Yes, the documentation may need to be updated .. sorry about that!

Re: line 201: Variable 'pPrNode' is multiply defined in the

PostPosted: Wed Mar 19, 2014 11:08 pm
by AndersG
I added jaxb-xmldsig-core-1.0.0.jar to the classpath, but I still see the same error.

Re: line 201: Variable 'pPrNode' is multiply defined in the

PostPosted: Wed Mar 19, 2014 11:11 pm
by AndersG
But that was with debugging on. I changed all debug and info in the xml to error and the error went away.