docx-stamper
docx-stamper copied to clipboard
Error: "The xml data is invalid according to the schema"
When opening produced docx files in Word, I get the following error:
The xml data is invalid according to the schema. Location: Part: /word/document.xml, Line:0, Column:0
And then Word opens another dialog saying:
Word found unreadable content in filename. Do you want to recover the content of this document? If you trust the source of this document, click yes
I found in this old forum that this might be an Docx4j issue that was fixed in 3.3.5, and I see docx-stamper uses 3.3.0. Maybe it'd be worth upgrading docx4j? https://www.docx4java.org/forums/docx-java-f6/invalid-xml-after-template-modification-t2718.html
An Upgrade to the newest packages that are used in stamper would be really grate
This issue seems to be caused by the fact that my template is a Word 2016 document, which is definitely the problem fixed in docx4j 3.3.5.
I just tested docx-stamper with docx4j 3.3.7 and it works like a charm without any other change. I don't know if further changes would be required for a migration to 6.0.1 (see issue https://github.com/thombergs/docx-stamper/issues/53), but at least 3.3.7 would be great.
I just performed another test with docx4j 6.0.1, and it also seems to work without any additional effort. I'm gonna make a PR.