Phoenix Logo

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:Copyright since 2013 by Oliver Schoenborn, all rights reserved.
license:BSD, see LICENSE_BSD_Simple.txt for details.

function_summary Functions Summary

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

class_summary Classes Summary



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

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

indent(elem, level=0)