• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Parse xmind file to programmable data type (e.g. json, xml), support xmind legacy and xmind zen file types.

xmindparser

PyPI

Parse xmind file to programmable data type (e.g. json, xml). Python 3.x required. Now it supports XmindZen file type as well.

See also: xmind2testlink / 中文文档

Installation

pip install xmindparser

Usage - Command Line

cd /your/xmind/dir

xmindparser your.xmind -json
xmindparser your.xmind -xml

Note: Parse to xml file type require dicttoxml.

Usage - via Python

from xmindparser import xmind_to_dict

d = xmind_to_dict('/path/to/your/xmind')
print(d)

See example output: json

Configuration

If you use xmindparser via Python, it provides a config object, check this example:

import logging
from xmindparser import xmind_to_dict,config

config = {'logName': 'your_log_name',
          'logLevel': logging.DEBUG,
          'logFormat': '%(asctime)s %(levelname)-8s: %(message)s',
          'showTopicId': True, # internal id will be included, default = False
          'hideEmptyValue': False  # empty values will be hidden, default = True
          }

d = xmind_to_dict('/path/to/your/xmind')
print(d)

Limitations (for Xmind legacy version)

Please note, following xmind features will not be supported or partially supported.

  • Will not parse Pro features, e.g. Task Info, Audio Note
  • Will not parse floating topics.
  • Will not parse linked topics.
  • Will not parse summary info.
  • Will not parse relationship info.
  • Will not parse boundary info.
  • Will not parse attachment object, only name it as [Attachment] - name
  • Will not parse image object, only name it as [Image]
  • Rich text format in notes will be parsed as plain text.

XmindZen Supporting

xmindparser will auto detect xmind file created by XmindZen or XmindPro, you can pass in ZEN file as usual.

from xmindparser import xmind_to_dict

d = xmind_to_dict('/path/to/your/xmind_zen_file')
print(d)

Please note, there are a few differences between xmind legacy and xmind zen.

  • Comments feature removed, so I will not parse it in ZEN.
  • Add feature - sticker, I parse it as image dict type.
  • Add feature - callout, I parse it as list type. (not sure existed in lagacy?)

Since XmindZen has upgraded the internal content file as json, you can read it by code like this:

import json

def get_xmind_zen_json(file_path):
    name = "content.json"
    with ZipFile(file_path) as xmind:
        if name in xmind.namelist():
            content = xmind.open(name).read().decode('utf-8')
            return json.loads(content)

        raise AssertionError("Not a xmind zen file type!")

# xmindparser also provides a shortcut
from xmindparser import get_xmind_zen_builtin_json

content_json = get_xmind_zen_builtin_json(xmind_zen_file)

Examples

Xmind Example

License

MIT

More Repositories

1

kog-money

一个王者荣耀刷金币的小外挂。
Python
356
star
2

Typora-Portable

The portable version of typora, 绿色免安装版Typora。
137
star
3

xmind2testlink

Convert xmind to test link xml files, support xmind pro and xmind zen.
HTML
109
star
4

wpath

WPath is a library to select Windows UI automatin element like XPath.
C#
27
star
5

testcube

Testcube is a platform to manage and monitor automation test results.
JavaScript
27
star
6

tampermonkey_vue

Demo to use vue in tampermonkey.
JavaScript
24
star
7

photodup

Find duplicate photos (or other file types) on your computer.
Python
20
star
8

flask_api_doc

A demo to auto document Flask api / endpoints.
Python
17
star
9

chrome_vue_ext_demo

A demo to use Vuejs in Chrome extension.
JavaScript
9
star
10

python_decorator

To tell how to use python decorator.
Python
7
star
11

toolbox

我的小工具箱
Lua
4
star
12

tobyqin.github.io.mm.bak

My github blog pages.
JavaScript
2
star
13

blog_hexo

Source code of my hexo blog, not in used anymore.
JavaScript
2
star
14

ccnet.tfsrevisionlabeller

TFS revision labller for CruiseControl.NET
C#
1
star
15

docs

Some documentation
JavaScript
1
star
16

hello-k8s

Python
1
star
17

pytools

A handy tool library for Python programming, to save my day!
Python
1
star
18

yo

Example of click command line tool
Python
1
star
19

opencv-automation-demo

A demo to use opencv to do UI automated testing.
Python
1
star
20

testcube-client

A python client for testcube.
Python
1
star
21

python_underscore

Shows how to use underscore in python.
Python
1
star
22

tobyqin.github.io

JavaScript
1
star
23

python_automation_utils

Some utility functions for Python automation testing.
Python
1
star
24

KeepScreenAlive

A small tool to keep screen alive, it will be helpful for UI automation or some specific situations.
C#
1
star