There seem to be some issues with HTML entities (e.g. " " or "–") while converting XHTML to Docx objects. The behaviour can easily be re-produced when editing the ConvertInXHTMLFragment sample (by simpy adding one of the HTML entities to the HTML code).
The error message looks like this:
- Code: Select all
org.docx4j.org.xhtmlrenderer.exception WARNING:: Unhandled exception. Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 20; Entität "ndash" wurde referenziert aber nicht deklariert.
Exception in thread "main" org.docx4j.openpackaging.exceptions.Docx4JException: issues at Line 1, Col 20
at org.docx4j.convert.in.xhtml.XHTMLImporter.convert(XHTMLImporter.java:396)
at org.docx4j.samples.ConvertInXHTMLFragment.main(ConvertInXHTMLFragment.java:45)
Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 20; Entität "ndash" wurde referenziert aber nicht deklariert.
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
at org.docx4j.org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:190)
at org.docx4j.org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:75)
at org.docx4j.convert.in.xhtml.XHTMLImporter.convert(XHTMLImporter.java:386)
... 1 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 20; Entität "ndash" wurde referenziert aber nicht deklariert.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
... 4 more
Any help is welcome, thanks!