customxmlhandler

The customxmlhandler module provides the XML functionality for custom slides

The basic XML is of the format:

<?xml version="1.0" encoding="UTF-8"?>
<song version="1.0">
    <lyrics language="en">
        <verse type="chorus" label="1">
            <![CDATA[ ... ]]>
        </verse>
    </lyrics>
</song>
class openlp.plugins.custom.lib.customxmlhandler.CustomXMLBuilder[source]

Bases: object

This class builds the XML used to describe songs.

add_lyrics_to_song()[source]

Set up and add a <lyrics> tag which contains the lyrics of the custom item.

add_verse_to_lyrics(verse_type, number, content)[source]

Add a verse to the <lyrics> tag.

Parameters:
  • verse_type – A string denoting the type of verse. Possible values are “Chorus”, “Verse”, “Bridge”, and “Custom”.
  • number – An integer denoting the number of the item, for example: verse 1.
  • content – The actual text of the verse to be stored.
extract_xml()[source]

Extract our newly created XML custom.

new_document()[source]

Create a new custom XML document.

class openlp.plugins.custom.lib.customxmlhandler.CustomXMLParser(xml)[source]

Bases: object

A class to read in and parse a custom’s XML.

get_verses()[source]

Iterates through the verses in the XML and returns a list of verses and their attributes.