phoenix_title wx.lib.pubsub.utils.xmltopicdefnprovider

Contributed by Joshua R English, adapted by Oliver Schoenborn to be consistent with pubsub API.

An extension for pubsub ( so topic tree specification can be encoded in XML format rather than pubsub’s default Python nested class format.

To use:

xml = ‘’’

<topicdefntree> <description>Test showing topic hierarchy and inheritance</description> <topic id=”parent”>

<description>Parent with a parameter and subtopics</description> <listenerspec>

<arg id=”name” optional=”true”>given name</arg> <arg id=”lastname”>surname</arg>


<topic id=”child”>

<description>This is the first child</description> <listenerspec>

<arg id=”nick”>A nickname</arg>



</topic> </topicdefntree>


These topic definitions are loaded through an XmlTopicDefnProvider:

pub.addTopicDefnProvider( XmlTopicDefnProvider(xml) )

The XmlTopicDefnProvider also accepts a filename instead of XML string:

provider = XmlTopicDefnProvider(“path/to/XMLfile.xml”, TOPIC_TREE_FROM_FILE) pub.addTopicDefnProvider( provider )

Topics can be exported to an XML file using the exportTopicTreeSpecXml function. This will create a text file for the XML and return the string representation of the XML tree.


Copyright since 2013 by Oliver Schoenborn, all rights reserved.


BSD, see LICENSE_BSD_Simple.txt for details.

function_summary Functions Summary


If rootTopic is None, then pub.getDefaultTopicTreeRoot() is assumed.


class_summary Classes Summary


All topic definition providers added via pub.addTopicDefnProvider()


Inappropriate argument value (of correct type).


Unspecified run-time error.


Derive from ITopicTreeVisitor and override one or more of the


exportTopicTreeSpecXml(moduleName=None, rootTopic=None, bak='bak', moduleDoc=None)

If rootTopic is None, then pub.getDefaultTopicTreeRoot() is assumed.

indent(elem, level=0)