Method and device for converting xmind file and computer equipment

By judging and converting the type of xmind files, it solves the problem of difficulty in converting high-version xmind files to Excel, realizes conversion between various versions, and reduces development costs and the probability of data errors.

CN118535623APending Publication Date: 2024-08-23JIANGSU BDSTAR AUTOMOTIVE ELECTRONICS CO LTD +3
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410440466.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-12
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

The existing technology is difficult to convert mind maps drawn in higher versions of xmind software into Excel sheets, resulting in high development costs and as the xmind software version is updated, the conversion tool of the old version is no longer applicable.

Method used

By judging whether the type of xmind file to be converted meets the conditions for direct conversion, if not, decompress and convert it into a suitable intermediate data format, put it into a preset template folder, and finally convert it into an Excel table to realize mutual conversion between various versions.

Benefits of technology

It realizes the conversion between various versions of xmind files and Excel, reduces development costs, is suitable for conversion of various versions, and reduces data omissions and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535623A
    Figure CN118535623A
Patent Text Reader

Abstract

The embodiment of the invention provides an xmind file conversion method and device and computer equipment, and belongs to the field of data processing.The method comprises the steps that when a to-be-converted xmind file is obtained, whether the type of the to-be-converted xmind file meets a direct conversion condition or not is judged; if not, decompressing the to-be-converted xmind file to obtain a first folder, and converting a first content file in a first data format in the first folder into a second content file in a second data format; putting the second content file into a preset direct conversion template folder to obtain a first intermediate xmind file; and converting the first intermediate xmind file into an Excel table. Therefore, the xmind file to be converted, which cannot be converted into the Excel table, is converted into the first intermediate xmind file in the second data format, and then the first intermediate xmind file is converted into the Excel table, so that conversion between xmind files of various versions and Excel can be realized. And meanwhile, the method is suitable for conversion of xmind files of various versions, and the development cost of xmind file conversion is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to an xmind file conversion method, device and computer equipment. Background Art

[0002] Xmind is a full-featured mind mapping and brainstorming software that can draw mind maps, fishbone diagrams, two-dimensional diagrams, tree diagrams, organizational charts and other display forms, and these display forms can be converted to each other. Xmind software is widely used in various fields. For example, testers use Xmind software to conceive and draw test cases, and managers use Xmind software to draw management architecture diagrams. During use, in order to facilitate subsequent processing, it is usually necessary to convert the final diagram on the Xmind software into an Excel table.

[0003] With the update of xmind software, the interface of the new version of xmind software has higher clarity, better aesthetics and more functions than the old version. However, currently only the conversion between the lower version of xmind and Excel can be performed, and it is difficult to convert the diagrams drawn in the higher version of xmind software to Excel. Summary of the invention

[0004] In view of this, the object of the present invention is to provide a method, device and computer equipment for converting xmind files, which can quickly convert the mind map of a higher version of xmind software into Excel.

[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a method for converting an xmind file, the method comprising:

[0007] When the xmind file to be transferred is obtained, it is determined whether the type of the xmind file to be transferred meets the direct transfer condition;

[0008] If not, decompress the xmind file to be converted to obtain a first folder, obtain a first content file in a first data format from the first folder, and convert the first content file into a second content file in a second data format;

[0009] Put the second content file into a preset direct conversion template folder to obtain a first intermediate xmind file;

[0010] Convert the first intermediate xmind file into an Excel table.

[0011] Optionally, the step of converting the first content file into a second content file in a second data format includes:

[0012] The first content file is read to obtain first content information; wherein the first content information includes a canvas name and canvas content of each canvas of the xmind file to be converted;

[0013] For each of the canvases, using the canvas name as the dictionary name of a preset template dictionary, writing the canvas content of the canvas into the template dictionary to obtain a first intermediate dictionary of the canvas;

[0014] All the first intermediate dictionaries are passed as parameters to a preset first template engine, and the first template engine is used for rendering to obtain a second content file in a second data format.

[0015] Optionally, the canvas content includes a subject, multiple nodes and sub-nodes of the nodes;

[0016] The step of writing the canvas content of the canvas into the template dictionary comprises:

[0017] According to the corresponding relationship, the subject is written into the subject item of the template dictionary, and according to the connection relationship between nodes and sub-nodes, all nodes and sub-nodes of the canvas are combined in a tree-like manner in the form of key-value pairs to obtain data items, and the data items are written into the template dictionary.

[0018] Optionally, the step of passing all the first intermediate dictionaries as parameters to a preset first template engine includes:

[0019] For each of the first intermediate dictionaries, using a preset first iterative parameter transfer function, according to the connection relationship, the data format of the first intermediate dictionary is converted to obtain a single parameter segment in a second data format;

[0020] All the single parameter segments are transmitted as parallel segments to the preset first template engine.

[0021] Optionally, the step of determining whether the type of the xmind file to be converted meets the direct conversion condition includes:

[0022] Parsing the xmind file to be converted, and obtaining the xmind version used for drawing the xmind file to be converted;

[0023] Determine whether the source code of the xmind version is open source, or determine whether the xmind version is one of the preset direct-conversion versions;

[0024] If not, it is determined that the xmind file does not meet the direct transfer condition.

[0025] Optionally, the method further comprises:

[0026] When receiving an Excel table to be converted, converting the Excel table into a second intermediate xmind file in a second data format;

[0027] decompressing the second intermediate xmind file to obtain a second folder, reading a third content file from the second folder, and converting the third content file into a fourth content file in the first data format;

[0028] Put the fourth content file into a preset xmind template folder to obtain a target xmind file.

[0029] Optionally, the step of converting the third content file into a fourth content file in the first data format includes:

[0030] Reading the third content file to obtain second content information;

[0031] Writing the second content information into a preset template dictionary to obtain a second intermediate dictionary;

[0032] The second intermediate dictionary is passed as a parameter to a preset second template engine, and the second template engine is used for rendering to obtain a fourth content file in the first data format.

[0033] Optionally, the second content information includes a topic, multiple nodes, and sub-nodes of the nodes;

[0034] The step of passing the second intermediate dictionary as a parameter to a preset second template engine includes:

[0035] Using the preset second iterative parameter transfer function, the connection relationship between each node and the child nodes of the node is iterated from the second intermediate dictionary, and the data format of the second intermediate dictionary is converted according to the subject and the connection relationship to obtain the target parameter segment in the first data format, and the target parameter segment is passed to the preset second template engine.

[0036] In a second aspect, an embodiment of the present invention provides an xmind file conversion device, including a first receiving module, a format conversion module, a file input module and an Excel generation module;

[0037] The first receiving module is used to determine whether the type of the xmind file to be converted meets the direct conversion condition when the xmind file to be converted is obtained;

[0038] The format conversion module is used for, if not, decompressing the xmind file to be converted to obtain a first folder, obtaining a first content file in a first data format from the first folder, and converting the first content file into a second content file in a second data format;

[0039] The file placing module is used to place the second content file into a preset direct transfer template folder to obtain a first intermediate xmind file;

[0040] The Excel generation module is used to convert the first intermediate xmind file into an Excel table.

[0041] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the xmind file conversion method as described in any optional manner in the first aspect.

[0042] In a fourth aspect, an embodiment of the present invention provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the xmind file conversion method as described in any optional manner in the first aspect is implemented.

[0043] The conversion method, device and computer equipment of the xmind file provided by the embodiment of the present invention include: when the xmind file to be converted is obtained, it is determined whether the type of the xmind file to be converted meets the direct conversion condition; if not, the xmind file to be converted is decompressed to obtain a first folder, and the first content file in the first data format in the first folder is converted into a second content file in the second data format; the second content file is placed in a preset direct conversion template folder to obtain a first intermediate xmind file; and the first intermediate xmind file is converted into an Excel table. In this way, it is only necessary to convert the xmind file to be converted that cannot be converted into an Excel table into the first intermediate xmind file in the second data format (i.e., the first intermediate xmind file in the direct conversion format), and then convert the first intermediate xmind file into an Excel table, so as to realize the conversion between various versions of xmind files and Excel. At the same time, it is applicable to the conversion of various versions of xmind files, which greatly reduces the development cost of xmind file conversion.

[0044] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0046] Figure 1 A schematic diagram of the structure of an xmind file conversion system provided by an embodiment of the present invention is shown.

[0047] Figure 2 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention is shown.

[0048] Figure 3 One of the flow charts of the xmind file conversion method provided by the embodiment of the present invention is shown.

[0049] Figure 4 A schematic diagram of the structure of a first folder provided by an embodiment of the present invention is shown.

[0050] Figure 5 A schematic diagram of the structure of a direct-to-template folder provided in an embodiment of the present invention is shown.

[0051] Figure 6 Shows Figure 3 Schematic diagram of the flow chart of some sub-steps of step S11.

[0052] Figure 7 Shows Figure 3 Schematic diagram of the flow chart of some sub-steps of step S13.

[0053] Figure 8 Shows Figure 7 Schematic diagram of the process of some sub-steps of step S133.

[0054] Fig. 9 The second flowchart of the xmind file conversion method provided by the embodiment of the present invention is shown.

[0055] Fig.10 Shows Fig. 9 Schematic diagram of the process of some sub-steps of step S33.

[0056] Fig.11 A schematic diagram of the structure of an xmind file conversion device provided by an embodiment of the present invention is shown.

[0057] Explanation of the accompanying drawings: 1000 - xmind file conversion system; 10 - conversion device; 20 - drawing device; 30 - computer device; 310 - memory; 320 - processor; 330 - communication module; 40 - xmind file conversion device; 410 - first receiving module; 420 - format conversion module; 430 - file input module; 440 - Excel generation module. DETAILED DESCRIPTION

[0058] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0059] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0060] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0061] The xmind file conversion method provided by the embodiment of the present invention can be applied to Figure 1 In the xmind file conversion system 1000 shown, the xmind file conversion system 1000 may include a conversion device 10 and a rendering device 20, and the conversion device 10 and the rendering device 20 may be communicatively connected via wired or wireless means.

[0062] The conversion device 10 is pre-installed with a conversion program between xmind and Excel, and the conversion program can directly convert the xmind file that meets the direct conversion conditions into an Excel table.

[0063] The drawing device 20 is used for drawing the xmind file, and when the xmind file needs to be converted into an Excel file, the xmind file to be converted is transmitted to the conversion device 10 as the xmind file to be converted.

[0064] The conversion device 10 is used to implement the xmind file conversion method provided by the embodiment of the present invention.

[0065] The drawing device 20 includes but is not limited to: personal computers, laptop computers, tablet computers, mobile terminals (such as mobile phones) and other computer devices, and the conversion device 10 includes but is not limited to: personal computers, laptop computers, tablet computers, mobile terminals, servers, server clusters and other computer devices 30. In addition, the drawing device 20 and the conversion device 10 can be the same computer device 30 or different computer devices.

[0066] Please refer to Figure 2 , is a block diagram of the computer device 30. Figure 1 The conversion device 10 can be Figure 2 The computer device 30 shown in FIG. 3 includes a memory 310, a processor 320, and a communication module 330. The memory 310, the processor 320, and the communication module 330 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.

[0067] The memory 310 is used to store programs or data. The memory 310 may be, but is not limited to, a random access memory 310 (RAM), a read only memory 310 (ROM), a programmable read-only memory 310 (PROM), an erasable programmable read-only memory 310 (EPROM), an electrically erasable read-only memory 310 (Electric Erasable Programmable Read-Only Memory 310 (EEPROM), etc.

[0068] The processor 320 is used to read / write data or programs stored in the memory 310 and execute corresponding functions.

[0069] The communication module 330 is used to establish a communication connection between the server and other communication terminals through the network, and to send and receive data through the network.

[0070] It should be understood that Figure 2 The structure shown is only a schematic diagram of the structure of the computer device 30. The computer device 30 may also include Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown. Figure 2 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0071] Please refer to Figure 3 The embodiment of the present invention provides a method for converting an xmind file, comprising the following steps. In this embodiment, the execution subject of the following steps is Figure 1 The conversion device 10 in.

[0072] S11, when the xmind file to be converted is obtained, it is determined whether the type of the xmind file to be converted meets the direct conversion condition. If not, step S13 is executed, and if yes, step S19 is executed.

[0073] S13, decompressing the xmind file to be converted to obtain a first folder, obtaining a first content file in a first data format from the first folder, and converting the first content file into a second content file in a second data format.

[0074] S15, putting the second content file into a preset direct conversion template folder to obtain a first intermediate xmind file.

[0075] S17, converting the first intermediate xmind file into an Excel table.

[0076] S19, convert the xmind file to be converted into an Excel table.

[0077] The first data format is the data format corresponding to the version of the xmind software used to convert the xmind file to be drawn, and the second data format is the data format of the xmind file that can be directly converted into an Excel table.

[0078] For example, after the tester draws a mind map of a test case on the drawing device 20, if the drawn xmind file needs to be converted into an Excel table for testing, the xmind file to be converted into an Excel table is sent to the conversion device 10 as the xmind to be converted.

[0079] After receiving the xmind file to be converted, when determining that the type of the xmind file to be converted does not meet the direct conversion conditions, the conversion device 10 decompresses the xmind file to be converted to obtain a first folder, obtains a first content file in a first data format from the first folder, and converts the first content file into a second content file in a second data format, that is, the first content file of the xmind file that does not meet the direct conversion conditions is converted into a second content file that is consistent with the data format of the xmind file that meets the direct conversion conditions. Then, the second content file is placed in a preset direct conversion template folder to obtain a first intermediate xmind file.

[0080] Assume that the conversion device 10 is installed with a conversion program for converting xmind8 to Excel. Calling the conversion program can directly convert the xmind8 version of the xmind file into an Excel table, while the non-open source xmind23 and above versions of the xmind file cannot directly obtain data and cannot be directly converted. When the xmind file to be converted is the xmind23 version, the first folder obtained after the xmind file to be converted is decompressed is as follows: Figure 4 As shown, content.json is the first content file. Convert the first content file content.json in the xmind file to be converted into the second content file conten.xml of the xmind8 version, and then put the converted second content file conten.xml into the following Figure 5 (a) shows the template folder, and the result is as follows Figure 5 (b) The first intermediate xmind file shown.

[0081] When the first intermediate xmind file or the xmind file that meets the direct conversion conditions is obtained, the preset conversion program is directly called to obtain the Excel table corresponding to the xmind file to be converted.

[0082] In the existing conversion method between xmind and Excel, it is difficult to use the conversion tool of the old version to convert xmind into an Excel table because the new version of xmind is not open source or the version is incompatible. Therefore, a complete conversion software or conversion tool is usually developed for the xmind version, and the conversion between the xmind and Excel of the version is realized using the conversion tool. However, the development cost of this method is high, and with the continuous updating of the xmind software version, the conversion program (tool) of the old version of xmind and Excel will no longer be used, resulting in waste.

[0083] In the xmind file conversion method provided by the embodiment of the present invention, through the above S11 to S19, it is only necessary to convert the xmind file to be converted that cannot be directly converted into the first intermediate xmind file of the second data format (i.e., the first intermediate xmind file of the directly convertible format), and then convert the first intermediate xmind file into an Excel table, so as to realize the conversion between xmind files of various versions and Excel. At the same time, it is applicable to the conversion of xmind files of various versions, which greatly reduces the development cost of xmind file conversion.

[0084] In S17 and S19, the formats of the first intermediate xmind file and the xmind file to be converted are consistent, so the way of converting the first intermediate xmind file / xmind file to be converted into an Excel table is also consistent. Among them, the way of converting the first intermediate xmind file / xmind file to be converted into an Excel table can be flexibly set, for example, it can be converted according to preset rules, or it can be converted using a preconfigured tool, which is not limited here.

[0085] The method of converting the first intermediate xmind file / xmind file to be converted into an Excel table may include S21 to S23.

[0086] S21, reading and parsing the mind map file to obtain multiple intermediate variables.

[0087] Among them, the mind map file is the first intermediate xmind file / xmind file to be transferred, and the mind map is composed of multiple nodes in a tree structure, namely a root node, a child node and a plurality of leaf nodes. Taking a test case as an example, a mind map file includes a theme and multiple sub-modules, the theme is a root node, all sub-modules are child nodes of the root node, each sub-module includes at least one test point, each test point is a child node of the sub-module to which it belongs, and each sub-module represents a test module. For example, the main module (i.e., the root node) is "System Settings" and can also be "Multimedia-Online Music".

[0088] Each test point includes any of the following: preconditions, use case content, and expected results. Each test point must include use case content and expected results. Use case content can also be understood as operation steps. The use case content of a test point is generally one operation step, in which case, only one expected result is included. When the use case content of a test point is two or more operation steps, there can be multiple expected results, and the expected results correspond to the use case content one by one.

[0089] When the use case content has multiple steps, it can be written in the form of "1.xxx\2.nnn", using the "\" symbol to distinguish each step in a line break. The order of nodes on a branch in a mind map is generally: main module-sub-module-prerequisite-use case content-expected result. The expected result is the sub-node of the use case content, and the expected results are all leaf nodes of the mind map. In addition, some nodes are configured with keywords for category identification. For example, keywords are configured for the two categories of nodes, test module and use case content, in the form of [M] sub-module, [TC] use case content. The use case content of each test point has its own unique ID number, which can be followed by the keyword identifier of the use case content, that is, TC <id>Use case content, e.g., TC <1> Use case content. It should be understood that the ID numbers may not be arranged in order.

[0090] Thus, S21 may include the following implementation steps.

[0091] S211, based on the keyword rule, read and parse the mind map file to determine the category of each sub-node in the mind map file.

[0092] The conversion device 10 can identify the category of the child node with the keyword according to the keyword, and then determine the category of the child node without the keyword based on the category of the child node with the keyword and according to the creation rules of the mind map. For example, when determining the test module and a use case content under the test module, the category of the child node of the node with the category of use case content is generally the expected result. If there is a node between the child node with the category of test module and the node with the category of use case content, the category of the node is a prerequisite. Therefore, after determining the category of the node with the keyword, the category of other nodes without the keyword can be determined.

[0093] S212, taking a single node as a breakpoint, split the mind map to obtain multiple fields.

[0094] S213, storing all fields from a child node whose category is a test module to a leaf node of the child node into an intermediate variable, and marking the category of each field to obtain multiple intermediate variables.

[0095] Among them, each field corresponds to a node, and each field in the intermediate variable is labeled with its own category.

[0096] S23, based on the set Excel table rules, convert each intermediate variable into a test case, and fill the test case in a blank Excel table to obtain the Excel table corresponding to the xmind to be converted.

[0097] S23 may include the following implementation steps.

[0098] S231, creating a blank Excel table according to preset rules.

[0099] Among them, the preset rules are the format rules of the test case table, each row of the blank Excel table represents a test case, each column of the blank Excel table represents a category, and the name of the Excel table is consistent with the subject (ie, the field corresponding to the main module).

[0100] S232: For each intermediate variable, match a row in a blank Excel table for the intermediate variable as a matching row.

[0101] S233, filling each field of the intermediate variable into a matching row in the blank Excel table according to the category correspondence.

[0102] The category correspondence refers to the correspondence between each column in the blank Excel table and the category of the field in the intermediate variable. The category correspondence can be pre-stored in the form of a data dictionary and can be directly called during conversion. After obtaining the category correspondence, you can quickly query the corresponding matching column for each field in the intermediate variable in the matching row and fill each field into the corresponding matching column in the blank Excel table.

[0103] For example, the module to which it belongs corresponds to the fields of the main module, and the use case name corresponds to the fields and ID numbers of the submodules. For example, the main module is "Instrument-TT Indicator-Main Body", and the sub-segments of the use case content in the intermediate variable include TC <97> , the module in the test case table is listed as "Instrument", and the case name is listed as "Instrument-TT Indicator-Main-test-97". The precondition column corresponds to the field with the category of precondition. Simply fill the content of the field with the category of precondition into the precondition column. Similarly, the execution step column, expected result column, corresponding requirement column, and modification record column are also the same.

[0104] Through the above S21 to S23 and related sub-steps, the xmind file that can be directly converted is quickly and accurately converted into an Excel table.

[0105] In S11, the method of judging whether the type of the xmind file to be converted meets the direct conversion condition can be flexibly set. For example, the developer can directly input whether direct conversion is allowed, or it can be judged according to preset rules, which is not limited here.

[0106] Reference Figure 6 In S11, the following steps can be used to determine whether the type of the xmind file to be converted meets the direct conversion conditions.

[0107] S111, parsing the xmind file to be converted, and obtaining the xmind version used for drawing the xmind file to be converted.

[0108] S112, determining whether the source code of the xmind version is open source, or determining whether the xmind version is one of the preset direct-conversion versions.

[0109] S113: If not, it is determined that the xmind file does not meet the direct transfer condition.

[0110] Since the developed xmind to Excel tool is developed based on the open source xmind version, its data format is different from the data format of the content file of the new version of xmind. Therefore, the non-open source xmind version cannot get the source code, and cannot call the third-party API interface of the developed xmind to Excel tool to obtain data. Therefore, when the xmind version of the xmind file to be converted is not open source or is not one of the preset direct conversion versions, it can be determined that it does not meet the direct conversion conditions.

[0111] Through the above S111 to S113, it is quickly determined whether the xmind file to be converted can be directly converted from the xmind file into an Excel table.

[0112] The conversion device 10 may be pre-configured with a first template engine in the second data format. The data format of the first template engine is related to the version of the first intermediate xmind file. In different scenarios, the first template engine may be adaptively adjusted as the first intermediate xmind file changes. When the first intermediate xmind file is a file of the xmind8 version, the first data format is .xml, and the first target engine may be a jinja2 template.

[0113] In order to quickly and accurately convert the xmind file to be converted into a file that can be directly converted, a template dictionary with a tree data structure is introduced to accurately record the connection relationship of each node in the process of converting the first content file into the second content file, thereby reducing data errors and data omissions. Figure 7 The process of converting the first content file into a second content file in a second data format in S13 may include the following steps.

[0114] S131, reading a first content file to obtain first content information.

[0115] The first content information includes the canvas name and canvas content of each canvas of the xmind file to be converted. It should be noted that different mind maps are drawn on different canvases.

[0116] S132 , for each canvas, using the canvas name as the dictionary name of a preset template dictionary, writing the canvas content of the canvas into the template dictionary to obtain a first intermediate dictionary of the canvas.

[0117] S133: passing all first intermediate dictionaries as parameters to a preset first template engine, and using the first template engine for rendering to obtain a second content file in a second data format.

[0118] The canvas content may include a subject, multiple nodes and sub-nodes of the node. The template dictionary may include a subject item and multiple data items.

[0119] In S132, the subject of the canvas can be written into the subject item (sheet_title) of the template dictionary according to the corresponding relationship, and all the nodes and sub-nodes of the canvas can be combined in the form of key-value pairs according to the connection relationship between the nodes and sub-nodes to obtain data items (i.e., children), and the data items are written into the template dictionary.

[0120] It should be noted that each node of the canvas has its own level. For each node of the first level, a data item of the node is created, and all child nodes of the node (including middle child nodes and leaf nodes) are traversed and combined in a tree-like manner in the form of key-value pairs to obtain a data item. That is, there are as many data items as there are nodes of the first level. And the data item is the value of the subject item (sheet_title).

[0121] In S133, refer to Figure 8 , the parameter passing process can include the following steps.

[0122] S1331 , for each first intermediate dictionary, using a preset first iterative parameter transfer function, according to the connection relationship, perform data format conversion on the first intermediate dictionary to obtain a single parameter segment in a second data format.

[0123] S1332, transferring all single parameter segments as parallel segments to the preset first template engine.

[0124] Among them, the single parameter segment can be a code segment in .xml format, and the first template engine is a file template (i.e., a code template) in the second data format. The first iterative parameter transfer function can be a render_topic function, which can traverse all data items in the first intermediate dictionary, convert the nodes and related sub-nodes in the currently traversed data item into a single parameter segment in the second data format in a connection order, and after passing the single segment into the content area of ​​the first template engine, continue to convert the next data item into a single parameter segment and pass it into the content area of ​​the first template engine until all data items are processed to complete the parameter transfer iteration.

[0125] Through the above-mentioned S131 to S133 and related sub-steps, with the help of the template dictionary and the first iterative parameter passing function, in the process of storing data into the dictionary and passing the parameters in the dictionary to the template engine, the connection relationship between nodes and sub-nodes is strictly followed, that is, tree-like parameter passing, which to a certain extent avoids the disorder of data transmission during the format conversion process, greatly reduces the probability of data omission or data connection errors, and ensures the accuracy of format conversion as much as possible.

[0126] In order to further reduce the cases of data omission or data loss, and to improve the accuracy of converting xmind files to Excel, after obtaining the first intermediate dictionary, the first intermediate dictionary can be tested to obtain the first total number of nodes at each level, and the first content file to be converted to the xmind file can be tested to obtain the second total number of nodes at each level. Then, in order from high level to low level, for the nodes of each level, the first total number and the second total number of nodes at the level are compared. If the two are inconsistent, all nodes at the level in the first intermediate dictionary and all nodes at the level in the second content file are extracted, and errors are displayed to instruct developers to modify manually.

[0127] The developer can manually modify the data in the first intermediate dictionary according to all nodes of the level in the first intermediate dictionary of the error reporting interface and all nodes of the level in the second content file to correct the data omission. After confirming that the data is correct, the conversion device 10 can execute S15 to perform subsequent conversion.

[0128] In order to realize the conversion between xmind and Excel tables, refer to Fig. 9 The xmind file conversion method provided by the embodiment of the present invention also includes the following steps.

[0129] S31, when an Excel table to be converted is received, converting the Excel table into a second intermediate xmind file in a second data format.

[0130] S33, decompressing the second intermediate xmind file to obtain a second folder, reading a third content file from the second folder, and converting the third content file into a fourth content file in the first data format.

[0131] S35, putting the fourth content file into a preset xmind template folder to obtain a target xmind file.

[0132] It should be understood that the above S31 to S35 are the reverse processes of S11 to S17. Taking the xmind23 file and Excel table as an example, the conversion process of S11 to S17 is: xmind23—>xmind8—>Excel table, and the conversion process of S31 to S35 is: Excel table—>xmind8—>xmind23.

[0133] Among them, the process of S31 is also the reverse process of S21 to S23, including: reading and converting the Excel table, identifying the category of each column in the Excel table, for each row in the Excel table, taking the content of each cell in the row as a field, and adding the keyword of the category of the column corresponding to the cell in the field to obtain a node, and then connecting all the nodes in the row according to the branch node order in the preset mind map rules to obtain a branch, taking the subject of the Excel table as the root node, connecting all branches to the root node, and obtaining the second intermediate xmind file.

[0134] The second content information includes a theme, multiple nodes and sub-nodes of the nodes. The process of converting the third content file into the fourth content file in S33 is the same as the process of converting the first content file into the second content file in S13. Fig.10 , including the following steps.

[0135] S331: Read the third content file to obtain second content information.

[0136] S332, writing the second content information into a preset template dictionary to obtain a second intermediate dictionary.

[0137] S333: passing the second intermediate dictionary as a parameter to a preset second template engine, and using the second template engine for rendering to obtain a fourth content file in the first data format.

[0138] The first content information includes a theme, multiple nodes and sub-nodes of the nodes. The second template engine is a file template (ie, a code template) in a first data format.

[0139] In S332, similar to S132, the theme of the canvas in the second content file can be written into the theme item (sheet_title) of the template dictionary according to the corresponding relationship, and all the nodes and sub-nodes of the canvas can be combined in the form of key-value pairs according to the connection relationship between the nodes and sub-nodes to obtain data items (i.e., children), and the data items are written into the template dictionary.

[0140] In S333, the preset second iterative parameter transfer function is used to iterate the connection relationship between each node and the child nodes of the node from the second intermediate dictionary, and the data format of the second intermediate dictionary is converted according to the theme and the connection relationship to obtain the target parameter segment in the first data format, and the target parameter segment is passed to the preset second template engine.

[0141] The second template engine is a template engine with the same structure as the content file of the target xmind file. For example, when the content file of the target xmind file is a .json file, the data format of the second target engine is a .json format. Optionally, the second template engine can also be a jinja2 template.

[0142] The second iterative parameter passing function may be a render_topic function, which may traverse all data items in the second intermediate dictionary, convert the nodes and related sub-nodes in the currently traversed data item into single-parameter segments in the first data format in the order of connection, and after passing the single-parameter segment into the content area of ​​the second template engine, continue to convert the next data item into a single-parameter segment and pass it into the content area of ​​the second template engine until all data items are processed to complete the parameter passing iteration.

[0143] Through the above S331 to S333, with the help of the template dictionary and the second iterative parameter passing function, in the process of storing data into the dictionary and passing the parameters in the dictionary to the template engine, the connection relationship between nodes and sub-nodes is strictly followed, that is, tree-like parameter passing, which avoids data transmission disorder during format conversion to a certain extent, greatly reduces the probability of data omission or data connection errors, and ensures the accuracy of format conversion as much as possible.

[0144] In order to further reduce the cases of data omission or data loss, and to improve the accuracy of converting Excel tables to xmind, after obtaining the second intermediate dictionary, the second intermediate dictionary can be tested to obtain the third total number of nodes at each level, and the third content file of the second intermediate xmind file can be tested to obtain the fourth total number of nodes at each level. Then, in order from high level to low level, for the nodes of each level, the third total number and the fourth total number of nodes at that level are compared. If the two are inconsistent, all nodes at that level in the second intermediate dictionary and all nodes at that level in the third content file are extracted, and errors are displayed to instruct developers to modify manually.

[0145] The developer can manually modify the data in the second intermediate dictionary according to all nodes of the level in the second intermediate dictionary of the error reporting interface and all nodes of the level in the third content file to correct the data omission. After confirming that the data is correct, the conversion device 10 can execute S35 to perform subsequent conversion.

[0146] Based on the same inventive concept as the xmind file conversion method provided in the above embodiment, the embodiment of the present invention further provides an xmind file conversion device 40, referring to Fig.11 , including a first receiving module 410, a format conversion module 420, a file input module 430 and an Excel generation module 440.

[0147] The first receiving module 410 is used to determine whether the type of the xmind file to be converted meets the direct conversion condition when the xmind file to be converted is obtained.

[0148] The format conversion module 420 is used to, if not, decompress the xmind file to be converted to obtain a first folder, obtain a first content file in a first data format from the first folder, and convert the first content file into a second content file in a second data format.

[0149] The file placing module 430 is used to place the second content file into a preset direct-conversion template folder to obtain a first intermediate xmind file.

[0150] The Excel generation module 440 is used to convert the first intermediate xmind file into an Excel table.

[0151] A second receiving module and an xmind generating module may also be included.

[0152] The second receiving module is used for converting the Excel table into a second intermediate xmind file in a second data format when receiving the Excel table to be converted.

[0153] The format conversion module 420 is further configured to decompress the second intermediate xmind file to obtain a second folder, read the third content file from the second folder, and convert the third content file into a fourth content file in the first data format.

[0154] The xmind generation module is used to put the fourth content file into a preset xmind template folder to obtain a target xmind file.

[0155] In the above-mentioned xmind file conversion device 40, through the synergy of the first receiving module 410, the format conversion module 420, the file input module 430 and the Excel generation module 440, it is only necessary to convert the to-be-converted xmind file that cannot be directly converted into the first intermediate xmind file of the second data format (i.e., the first intermediate xmind file of the direct conversion format), and then convert the first intermediate xmind file into an Excel table, so as to realize the conversion between various versions of xmind files and Excel. At the same time, it is applicable to the conversion of various versions of xmind files, which greatly reduces the development cost of xmind file conversion.

[0156] For the specific implementation and effect of the xmind file conversion device 40, please refer to the above description of the implementation of the xmind file conversion method, such as, for the specific implementation and effect of the first receiving module 410, please refer to the above description of S11, for the specific implementation and effect of the format conversion module 420, please refer to the above description of S13, for the specific implementation and effect of the file input module 430, please refer to the above description of S15 and related sub-steps, for the specific implementation and effect of the Excel generation module 440, please refer to the above description of S17 and related sub-steps, for the specific implementation and effect of the second receiving module, please refer to the above description of S31, for the specific implementation and effect of the format conversion module 420, please refer to the above description of S33, for the specific implementation and effect of the xmind generation module, please refer to the above description of S35, and no further details will be given here.

[0157] Each module in the xmind file conversion device 40 can be implemented in whole or in part by software, hardware or a combination thereof. Figure 3 The processor 320 in the computer device 30 may also be stored in the memory 310 of the computer device 30 in the form of software, so that the processor 320 can call and execute the operations corresponding to the above modules. At the same time, the data and program codes required to execute the above modules may be stored in the memory 310.

[0158] An embodiment of the present invention also provides a computer device 30, including a processor 320 and a memory 310, wherein the memory 310 stores machine executable instructions that can be executed by the processor 320, and the processor 320 can execute the machine executable instructions to implement the xmind file conversion method proposed above.

[0159] The embodiment of the present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 320, the xmind file conversion method described above is implemented.

[0160] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0161] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0162] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0163] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.< / id>

Claims

1. A method for converting an xmind file, characterized in that: The method comprises: When the xmind file to be transferred is obtained, it is determined whether the type of the xmind file to be transferred meets the direct transfer condition; If not, decompress the xmind file to be converted to obtain a first folder, obtain a first content file in a first data format from the first folder, and convert the first content file into a second content file in a second data format; Put the second content file into a preset direct conversion template folder to obtain a first intermediate xmind file; Convert the first intermediate xmind file into an Excel table.

2. The xmind file conversion method according to claim 1, characterized in that: The step of converting the first content file into a second content file in a second data format comprises: The first content file is read to obtain first content information; wherein the first content information includes a canvas name and canvas content of each canvas of the xmind file to be converted; For each of the canvases, using the canvas name as the dictionary name of a preset template dictionary, writing the canvas content of the canvas into the template dictionary to obtain a first intermediate dictionary of the canvas; All the first intermediate dictionaries are passed as parameters to a preset first template engine, and the first template engine is used for rendering to obtain a second content file in a second data format.

3. The xmind file conversion method according to claim 2, characterized in that: The canvas content includes a subject, multiple nodes and sub-nodes of the nodes; The step of writing the canvas content of the canvas into the template dictionary comprises: According to the corresponding relationship, the subject is written into the subject item of the template dictionary, and according to the connection relationship between nodes and sub-nodes, all nodes and sub-nodes of the canvas are combined in a tree-like manner in the form of key-value pairs to obtain data items, and the data items are written into the template dictionary.

4. The xmind file conversion method according to claim 3, characterized in that: The step of passing all the first intermediate dictionaries as parameters to a preset first template engine includes: For each of the first intermediate dictionaries, using a preset first iterative parameter transfer function, according to the connection relationship, the data format of the first intermediate dictionary is converted to obtain a single parameter segment in a second data format; All the single parameter segments are transmitted as parallel segments to the preset first template engine.

5. The xmind file conversion method according to any one of claims 1 to 4, characterized in that: The step of determining whether the type of the xmind file to be converted meets the direct conversion condition comprises: Parsing the xmind file to be converted, and obtaining the xmind version used for drawing the xmind file to be converted; Determine whether the source code of the xmind version is open source, or determine whether the xmind version is one of the preset direct-conversion versions; If not, it is determined that the xmind file does not meet the direct transfer condition.

6. The xmind file conversion method according to claim 1, characterized in that: The method further comprises: When receiving an Excel table to be converted, converting the Excel table into a second intermediate xmind file in a second data format; decompressing the second intermediate xmind file to obtain a second folder, reading a third content file from the second folder, and converting the third content file into a fourth content file in the first data format; Put the fourth content file into a preset xmind template folder to obtain a target xmind file.

7. The xmind file conversion method according to claim 6, characterized in that: The step of converting the third content file into a fourth content file in the first data format comprises: Reading the third content file to obtain second content information; Writing the second content information into a preset template dictionary to obtain a second intermediate dictionary; The second intermediate dictionary is passed as a parameter to a preset second template engine, and the second template engine is used for rendering to obtain a fourth content file in the first data format.

8. The xmind file conversion method according to claim 7, characterized in that: The second content information includes a topic, a plurality of nodes and sub-nodes of the nodes; The step of passing the second intermediate dictionary as a parameter to a preset second template engine includes: Using the preset second iterative parameter transfer function, the connection relationship between each node and the child nodes of the node is iterated from the second intermediate dictionary, and the data format of the second intermediate dictionary is converted according to the subject and the connection relationship to obtain the target parameter segment in the first data format, and the target parameter segment is passed to the preset second template engine.

9. A conversion device for xmind files, characterized in that: It includes a first receiving module, a format conversion module, a file putting module and an Excel generating module; The first receiving module is used to determine whether the type of the xmind file to be converted meets the direct conversion condition when the xmind file to be converted is obtained; The format conversion module is used for, if not, decompressing the xmind file to be converted to obtain a first folder, obtaining a first content file in a first data format from the first folder, and converting the first content file into a second content file in a second data format; The file placing module is used to place the second content file into a preset direct transfer template folder to obtain a first intermediate xmind file; The Excel generation module is used to convert the first intermediate xmind file into an Excel table.

10. A computer device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the xmind file conversion method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • A mind map use case file conversion method and device

    CN109740122A

  • A method and system for achieving format conversion of a test case file

    CN113822021A

  • Method and system based on test case multi-format conversion and automatic process management

    CN115495386A

  • Method, device and computer readable storage medium for visualization of test cases

    US20190324894A1