I am trying to use docx4j on my project. (I'm quite a newbies on it.)
I just try to run the sample code from this link.
http://www.smartjava.org/content/create-complex-word-docx-documents-programatically-docx4j
The input is .docx file and the output is also a .docx file.
And here is what the console gave me when It tried to read my template file:
2015-09-10 09:58:43,847 [main] ERROR org.docx4j.XmlUtils - jaxp_feature_not_supported: Feature "http://apache.org/xml/features/disallow-doctype-decl" is not supported.
javax.xml.parsers.ParserConfigurationException: jaxp_feature_not_supported: Feature "http://apache.org/xml/features/disallow-doctype-decl" is not supported.
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.setFeature(DocumentBuilderFactoryImpl.java:207)
at org.docx4j.XmlUtils.<clinit>(XmlUtils.java:240)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:686)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:132)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:454)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:371)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:337)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:302)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:170)
at Experiment.getTemplate(Experiment.java:26)
at Experiment.main(Experiment.java:112)
The environment list here:
Java: 1.5
Library Management: Maven
Lib: Version
docx4j: 3.2.1
jaxb-api: 2.1 (Need to add it because Java 1.5 not include this)
jaxb-impl: 2.1 (Need to add it because Java 1.5 not include this)
I want to know how to deal with this error.
I try to solve this on my own but got no result.
Thanks for helping me.
EDIT: I just found my answer for this when I read the changelog carefully.
V.3.2.0
...
Minimum Java version is Java 6 (since guava and ambassador are compiled for that)
I guess I need to go back to version 3.1.0. :| ( and It run smoothly.)