Page 1 of 1

Warnings when parsing various parts of a DocX

PostPosted: Mon Nov 16, 2020 10:10 pm
by corvwyn
Hi

I'm generating a DocX with a rendering engine, and using Docx4j to change fonts that are not in the list of accepted fonts. Unfortunately we get some warnings. I'm not able to provide a sample docx at the moment, but I think the examples I provide will be sufficient. I have also uploaded a txt file containing the full log output.

We're using Java 11 and docx4j-JAXB-MOXy 11.1.8. I did use docx4j-JAXB-ReferenceImpl before, which produces the same DocX result, but the log output isn't as easy to understand.

Are these errors in the generated DocX file?

Warning 1 (/word/document.xml)
WARN o.d.jaxb.JaxbValidationEventHandler - [ERROR] : Exception Description: No conversion value provided for the value [Fixed] in field [@ns0:type]
WARN o.d.jaxb.JaxbValidationEventHandler - Column is 34 at line number 6

o.d.o.parts.JaxbXmlPartXPathAware -
Exception Description: No conversion value provided for the value [Fixed] in field [@ns0:type].
Mapping: org.eclipse.persistence.oxm.mappings.XMLDirectMapping[type-->@ns0:type]
Descriptor: XMLDescriptor(org.docx4j.wml.CTTblLayoutType --> [])
org.eclipse.persistence.exceptions.DescriptorException:
Exception Description: No conversion value provided for the value [Fixed] in field [@ns0:type].
Mapping: org.eclipse.persistence.oxm.mappings.XMLDirectMapping[type-->@ns0:type]
Descriptor: XMLDescriptor(org.docx4j.wml.CTTblLayoutType --> [])
at org.eclipse.persistence.exceptions.DescriptorException.noFieldValueConversionToAttributeValueProvided(DescriptorException.java:1068)

Here is an extract from /word/document.xml. Line 2 to 10.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
        <w:body>
                <w:tbl>
                        <w:tblPr>
                                <w:tblLayout w:type="Fixed"/>
                                <w:tblW w:w="10137" w:type="dxa"/>
                                <w:tblBorders/>
                                <w:tblInd w:w="0" w:type="dxa"/>
                        </w:tblPr>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Warning 2 (/word/header12.xml, /word/footer11.xml, /word/header9.xml, /word/footer13.xml)

WARN o.d.o.parts.JaxbXmlPartXPathAware -
Exception Description: An error occurred unmarshalling the document
Internal Exception: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 17; unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"tblCellMar"). Expected elements are <{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblPr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tblGrid>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}ins>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}permEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlMoveFromRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveTo>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveToRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlDelRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveToRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}proofErr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}permStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}commentRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlInsRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlInsRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlMoveToRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveFromRangeStart>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sdt>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}del>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlMoveToRangeStart>,<{http://schemas.openxmlformats.org/officeDocument/2006/math}oMathPara>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlDelRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveFromRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}moveFrom>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tr>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}commentRangeStart>,<{http://schemas.openxmlformats.org/officeDocument/2006/math}oMath>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXmlMoveFromRangeEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}bookmarkEnd>,<{http://schemas.openxmlformats.org/wordprocessingml/2006/main}customXml>

Here is an extract from /word/header12.xml. Line 2 to 13.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<w:hdr xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" mc:Ignorable="w14 wp14" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
        <w:tbl>
                <w:tblPr>
                        <w:tblW w:w="10137" w:type="dxa"/>
                </w:tblPr>
                <w:tblGrid>
                        <w:gridCol w:w="10137"/>
                </w:tblGrid>
                <w:tblCellMar>
                        <w:left w:w="0" w:type="dxa"/>
                        <w:right w:w="0" w:type="dxa"/>
                </w:tblCellMar>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

Re: Warnings when parsing various parts of a DocX

PostPosted: Tue Nov 17, 2020 11:03 am
by jason
I created a simple docx in current Word on Windows.

Word wrote:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
      <w:tblPr>
        <w:tblStyle w:val="TableGrid"/>
        <w:tblW w:w="0" w:type="auto"/>
        <w:tblLayout w:type="fixed"/>
        <w:tblCellMar>
          <w:left w:w="360" w:type="dxa"/>
        </w:tblCellMar>
        <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
      </w:tblPr>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


and docx4j was happy unmarshalling this.

For your warning 1, note that Word writes w:tblLayout/@w:type="fixed" (lowercase 'f' for fixed). In your XML, you have an uppercase 'F'.

For your warning 2, w:tblCellMar should be a child of w:tblPr. In your XML, it is a sibling.

Do you know how this problematic content came to be in your docx?

Re: Warnings when parsing various parts of a DocX

PostPosted: Tue Nov 17, 2020 7:09 pm
by corvwyn
This DocX is generated from XML + XSLT with a rendering engine, and I haven't modified it.

I figured the uppercase F in fixed "might" be a problem.

Thanks for your answers. I will report this as a bug in the rendering engine.