Error in generating PDF file: fo:block is not a valid child of fo:list-block!

0
I am getting an error when trying to generate a pdf containing a string generated by the CKEditor widget. The message seems to be that: "fo:block" is not a valid child of "fo:list-block"! Feb 26 17:08:21.434 127.0.0.1 tr10000: ERROR - Connector: (1/134) com.mendix.modules.microflowengine.MicroflowException: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: "fo:block" is not a valid child of "fo:list-block"! (See position 13:64) This is the content of the string, with the contents of the spans replaced: <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat:</span></p> <ul><br /> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> </ul> <p><span style="font-size:small">& nbsp;</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<a href="http://www.example.com">www.example.com</a></span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span></p> <p><span style="font-size:small">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua: &nbsp;</span></p> <p><span style="font-size:small"><a href="http://www.example.com/blabla.pdf">www.example.com/blabla.pdf</a>.</span></p> <p><span style="font-size:small"><strong>& nbsp;</strong></span></p> <p><span style="font-size:small"><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua:</strong></span></p> <ul> <li><span style="font-size:small">Lorem ipsum dolor sit amet;</span></li> <li><span style="font-size:small">Lorem ipsum dolor sit amet</span></li> </ul> What is going wrong here? edit: the empty space in the first underneath the first list should contain "& nbsp;" but the snippet doesnt show it properly.
asked
3 answers
1

Hi Robbert,

I tested it with the code you gave me. First I tried to let an html validator validate it. This came out:

Line 9, Column 4: document type does not allow element "UL" here


    ✉ The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    So I removed the "BR tag" and then it worked fine.

answered
2

Double check the actual string. My gut feeling is that there is an invalid character in there that breaks the pdf creation.

Regards,

Ronald

[EDIT]

Thanks Sebastiaan for finding the cause. Proves my point in the post here. It would be so nice if all the rich text editors would produce correct XHTML. Because now it is almost impossible for the regular user to debug the produced string.

answered
1

The report generator seems to be extremely strict parsing html tags and throws this sort of error if there is anything that it doesn't like. Typical causes are tags that are opened but not closed, or unexpected characters. I know you have changed the text in the example above, but the last but one line in the list has a semicolon (;) at the end of the text which it might not like. Also you have a <ul><br />. The break tag inside the list might be causing an issue.

There is also a setting in the CKEditor called Entermode which can affect the use of the break tag. Try changing this and see if it has any effect. In some situations I have had to put the html formatted text in a plain text field to be able to manually change it to see what has been causing the issue.

answered