Skip to content

ReportLab's XML Tools

We've been around for a very long time. When we got started with RML in 2001, we rapidly found a need for a lot of markup processing tools, and Python did not have the standard solutions it has today.

This page documents some of the functions in the rlextra.radxml package which you might find useful.

Sanitising markup, and converting to RML

functions in html_cleaner

Here are some important clean functions within rlextra.

cleanBlocks(input, **options)

Accept markup as one or more blocks.

The output of this should be safe for use within a

or tag in HTML, and also convertible to RML.

cleanInline(input, **options)

Accept and normalize markup for use inline.

The output of this should be safe for use within a

tag in HTML, and also convertible to RML.

cleanPlain(input, **options)

Remove all tags to output plain text.

functions in xhtml2rml

xhtml2rml(xml, paraStyle='normal', tableStyle='noPaddingStyle', bulletStyle='bullet', pathTransform=None, imageTransformKwds={}, allowMailtoLinks=False, useModernLists=True, ulStyle=None, olStyle=None, liParaStyle=None, tagAttrs={},)

Convert chunk of our mini-html to RML.