(moduleName=None, rootTopic=None, bak='bak', moduleDoc=None)
return ET.tostring(tree)
If rootTopic is None, then pub.getDefaultTopicTreeRoot() is assumed.
If rootTopic is None, then pub.getDefaultTopicTreeRoot() is assumed.
If rootTopic is None then pub . getDefaultTopicTreeRoot () is assumed .
def exportTopicTreeSpecXml(moduleName=None, rootTopic=None, bak='bak', moduleDoc=None):
    """
    If rootTopic is None, then pub.getDefaultTopicTreeRoot() is assumed.
    """

    if rootTopic is None:
        from .. import pub
        rootTopic = pub.getDefaultTopicTreeRoot()
    elif isinstance(rootTopic, str):
        from .. import pub
        rootTopic = pub.getDefaultTopicMgr().getTopic(rootTopic)

    tree = ET.Element('topicdefntree')
    if moduleDoc:
        mod_desc = ET.SubElement(tree, 'description')
        mod_desc.text = ' '.join(moduleDoc.split())

    traverser = pub.TopicTreeTraverser(XmlVisitor(tree))
    traverser.traverse(rootTopic)

    indent(tree)

    if moduleName:

        filename = '%s.xml' % moduleName
        if bak and Path(filename).exists():
            backupName = '%s.%s' % (filename, bak)
            shutil.copy(filename, backupName)

        fulltree = ET.ElementTree(tree)
        fulltree.write(filename, "utf-8", True)

    return ET.tostring(tree)
def exportTopicTreeSpecXml ( moduleName = None , rootTopic = None , bak = 'bak' , moduleDoc = None ) : if rootTopic is None : from . . import pub rootTopic = pub . getDefaultTopicTreeRoot ( ) elif isinstance ( rootTopic , str ) : from . . import pub rootTopic = pub . getDefaultTopicMgr ( ) . getTopic ( rootTopic ) tree = ET . Element ( 'topicdefntree' ) if moduleDoc : mod_desc = ET . SubElement ( tree , 'description' ) mod_desc . text = ' ' . join ( moduleDoc . split ( ) ) traverser = pub . TopicTreeTraverser ( XmlVisitor ( tree ) ) traverser . traverse ( rootTopic ) indent ( tree ) if moduleName : filename = '%s.xml' % moduleName if bak and Path ( filename ) . exists ( ) : backupName = '%s.%s' % ( filename , bak ) shutil . copy ( filename , backupName ) fulltree = ET . ElementTree ( tree ) fulltree . write ( filename , "utf-8" , True ) return ET . tostring ( tree )