plutext / docx4j-ImportXHTML

Converts XHTML to OpenXML WordML (docx) using docx4j
136 stars 125 forks source link

XHTMLImporterImpl.convert() can't handle converting custom data attributes for br tags to xhtml #101

Open JamaicanFriedChicken opened 10 months ago

JamaicanFriedChicken commented 10 months ago

I have a data attribute that is appended in a <br> tag, for example <br data-suggestion="ef0oraskdmd">, when I am trying to convert it into a xhtml format, it gives me the below error:

ERROR org.docx4j.convert.in.xhtml.XHTMLImporterImpl - org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55991; The element type "br" must be terminated by the matching end-tag "</br>"."

When I remove the data attribute data-*, XHTMLImporterImpl is able to convert it to a xhtml format. How can I mitigate this issue? Is there any temporary fix I can implement?

docx4j-ImportXHTML - 11.4.6 Java 11