[reportlab-users] xml parser error (invalid attribute name class) in paragraph

Robin Becker robin at reportlab.com
Thu Dec 13 07:24:24 EST 2012


On 12/12/2012 18:09, Jon.Reinsch wrote:

> from reportlab.lib.styles import ParagraphStyle

> from reportlab.platypus import *

> classrowstyle =

> ParagraphStyle(name="classrowstyle",fontSize=8,fontName="Helvetica",leading=11)

> row1 = '<span class="protected">simplified</span>'

> details = Paragraph(row1,classrowstyle)



I'm not sure exactly when you developed your solution, but between the release
of 2.5 and 2.6 (11 November 2011) we added support for the <span> tag. However
we don't support class as an attribute, but we do support style.

I have checked your example in revision 3774 (just prior to the change) and
while it works it takes no notice of the span tag ie only the content of the tag
'simplified' appears in the output.

Currently our 'span' supports various attributes, but not class. We have argued
internally for an hour about the wisdom of adding the 'span' tag and not having
an exact html match for all attributes, but the tag is now added and doesn't
support all html attributes.

An easy fix would be to allow unknown attributes and just ignore them. I'll
consult my colleagues about the possibility of doing that as a fix for your problem.
--
Robin Becker


More information about the reportlab-users mailing list