Method, apparatus and medium for generating a configuration file based on a table

The method of generating configuration files through tables uses predetermined rules to write configuration information into tables and generate configuration files, which solves the problems of high configuration file complexity and difficulty of manual editing in existing technologies, and achieves the accuracy and ease of use of configuration files.

CN116149720BActive Publication Date: 2026-07-31CHINA TELECOM CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2021-11-22
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing software configuration files are highly complex, difficult to edit manually, and prone to errors.

Method used

The method of generating configuration files using tables involves writing configuration information into a table according to predefined rules, and then the program reads the table and generates the configuration file based on the rules.

Benefits of technology

It reduces the difficulty of manually editing software configuration files and improves the accuracy of configuration files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116149720B_ABST
    Figure CN116149720B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, an apparatus, and a medium for generating a configuration file based on a table. A method for generating a configuration file based on a table is provided, including: writing configuration information in a table according to a predetermined rule; reading the configuration information written in the table by a program; and generating a configuration file according to the predetermined rule and the read configuration information by the program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure generally relates to methods, apparatus, and media for generating configuration files based on tables. Background Technology

[0002] Software is now used across various industries. To enhance its scalability and meet users' personalized needs, most software uses configuration files to achieve configurability. However, as software functionality becomes increasingly rich, the complexity of configuration files also increases. Manually editing configuration files, which was previously difficult, is becoming more challenging due to the large workload and the high error rate associated with strictly formatted configuration files (such as XML files).

[0003] This disclosure is made in order to address one or more problems in the prior art. Summary of the Invention

[0004] A brief overview of this disclosure is given below to provide a basic understanding of some aspects of it. However, it should be understood that this overview is not an exhaustive summary of this disclosure. It is not intended to identify key or essential parts of this disclosure, nor is it intended to limit the scope of this disclosure. Its purpose is merely to present certain concepts of this disclosure in a simplified form as a prelude to the more detailed description that follows.

[0005] According to one aspect of this disclosure, a method for generating a configuration file based on a table is provided, comprising: writing configuration information into a table according to predetermined rules; reading the configuration information written into the table by a program; and generating a configuration file by the program according to the predetermined rules and the read configuration information.

[0006] According to another aspect of this disclosure, an apparatus for generating configuration files based on tables is provided, comprising: a memory having instructions stored thereon; and a processor configured to execute the instructions stored in the memory to perform the method described above.

[0007] According to another aspect of this disclosure, a computer-readable storage medium is provided, comprising computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the method described above according to the present disclosure. Attached Figure Description

[0008] The accompanying drawings, which form part of this specification, illustrate embodiments of this disclosure and, together with the specification, serve to explain the principles of this disclosure.

[0009] This disclosure will be more clearly understood with reference to the accompanying drawings and the following detailed description, wherein:

[0010] Figure 1 This is a flowchart illustrating a method for generating a configuration file based on a table according to an embodiment of the present disclosure.

[0011] Figure 2 An example configuration file generated according to one embodiment of this disclosure is shown.

[0012] Figure 3 An exemplary configuration of a computing device that can implement embodiments of the present disclosure is shown. Detailed Implementation

[0013] The following detailed description is based on the accompanying drawings and provides various exemplary embodiments of the present disclosure to aid in a comprehensive understanding. Various details are included in the following description to aid understanding; however, these details are considered exemplary only and not intended to limit the present disclosure, which is defined by the appended claims and their equivalents. The words and phrases used in the following description are intended only to provide a clear and consistent understanding of the present disclosure. Additionally, descriptions of well-known structures, functions, and configurations may have been omitted for clarity and brevity. Those skilled in the art will recognize that various changes and modifications can be made to the examples described herein without departing from the spirit and scope of the present disclosure.

[0014] This disclosure proposes a method for generating configuration files based on tables. Figure 1 This is a flowchart illustrating the process of a table-based configuration file generation method (100) according to an embodiment of the present disclosure.

[0015] According to one embodiment of the present disclosure, a method (100) for generating a configuration file based on a table is provided, comprising: writing configuration information into a table according to a predetermined rule (S101); reading the configuration information written into the table by a program (S102); and generating a configuration file by a program according to the predetermined rule and the read configuration information (S103).

[0016] In one embodiment, the table can be any table, such as an Excel spreadsheet, a table in a document generated by word processing software such as Word, a table printed or hand-drawn on paper, a table in an image such as a photograph or picture.

[0017] In one embodiment, the program can perform image recognition on a table in a paper or image to read configuration information from the table.

[0018] A program can be any program that executes on the processor of a computing device, including any program that is executed by computer instructions, such as software tools, operating systems, API interfaces in operating systems, applets or plugins in web pages.

[0019] The generated configuration file can be any configuration file for a program, such as software, and can be an XML file. The configuration file can contain two elements: commands and parameters.

[0020] In one embodiment, a predefined rule may include: a configuration message written in a cell of a table representing one of the following elements: a command in the configuration file; an end marker of the command in the configuration file; and a parameter in the configuration file.

[0021] Table 1 below is an example of a table containing configuration information filled in by the user. As shown in Table 1, for example, the configuration information "cmd1#first cmd" in the top cell represents a command in the configuration file, the configuration information "$INT@<1-5>#param1+" in the second row and second column represents a parameter in the configuration file (here, this parameter is the parameter of the command cmd1), and the configuration information ">new_view" in the second row and third column represents the end marker of the command in the configuration file (here, it is the end marker of the command cmd1).

[0022] In one embodiment, the predetermined rules may further include: determining the subordinate relationship between elements represented by the configuration information in the cells based on the positional relationship between cells in the table, and determining the attributes of the elements represented by the configuration information based on predetermined characters in the configuration information.

[0023] For example, as shown in Table 1, the configuration information "$STRING#param2" in the third row and fifth column has the configuration information "cmd2#sub cmd1" to its left. Therefore, it can be determined that the configuration information "$STRING#param2" belongs to the configuration information "cmd2#sub cmd1".

[0024]

[0025] Table 1

[0026] In one embodiment, the predetermined rules may further include: for configuration information in a cell, configuration information starting with a first character represents a parameter; configuration information starting with a second character represents the end marker of a command; and configuration information starting with characters other than the first and second characters represents a command.

[0027] For example, as shown in Table 1, an entire configuration message beginning with the predefined character "$" (an example of the first character) can describe a parameter in the configuration file. An entire configuration message beginning with the predefined character ">" (an example of the second character) (such as ">new_view" or ">") can indicate that the attribute or type of the element described by the configuration message is the end marker of a command in the configuration file. An entire configuration message beginning with a character other than the predefined characters "$" and ">" (e.g., the characters "c", "C", and any other arbitrary characters) can indicate that the attribute or type of the element described by the configuration message is a command in the configuration file.

[0028] In one embodiment, the predefined rule may further include: for configuration information in a cell, a string starting with the third character represents a description of the element.

[0029] For example, as shown in Table 1, the predefined character "#" (which is an example of a third character) can indicate that the string following it is a description of an element. For example, in the configuration information "cmd1#first cmd", "first cmd" is a description of the command element cmd1, and in the configuration information "$INT@<1-5>#param1+", "param1+" is a description of the parameter element.

[0030] In this disclosure, "configuration information starting with a specific character" refers to all configuration information in a cell that begins with that specific character. For example, all configuration information "$INT@<1-5>#param1+" in the cell of row 2, column 2 of Table 1 begins with the specific character $. In contrast, "string starting with a specific character" refers to a string in the middle of configuration information in a cell that begins with that specific character; that is, the specific character is not the starting character of the entire configuration information. For example, the string "@<1-5>" in the configuration information "$INT@<1-5>#param1+" in the cell of row 2, column 2 of Table 1 begins with the specific character @, but that character @ is not the starting character of the entire configuration information.

[0031] In one embodiment, the predetermined rule may further include: in the configuration information representing the parameter, a fourth character indicates that the parameter represented by the configuration information is a repeatable input parameter; and a fifth character indicates that the parameter represented by the configuration information is an optional parameter.

[0032] For example, as shown in Table 1, in the configuration information “$INT@<1-5>#param1+”, the predefined character “+” (which is an example of the fourth character) indicates that the parameter param1 represented by this configuration information is a repeatable input parameter, that is, it means that the parameter can be entered once or multiple times.

[0033] Repeatable input parameters can be represented in the following ways for the command cmd1 to have the following input format:

[0034] Format 1 (enter once): cmd1 123

[0035] Format 2 (enter twice): cmd1 123 33

[0036] Format 3 (enter 3 times): cmd1 123 33 455

[0037] If the predefined character "+" is not included, then only one integer parameter can be entered after the command cmd1.

[0038] Furthermore, as shown in Table 1, in the configuration information "$INT@<2-9>#param5?", the predefined character "?" (which is an example of the fifth character) indicates that the parameter param5 represented by this configuration information is an optional parameter; that is, it means that the parameter can be entered or not. This is reflected in the fact that the input form of the command cmd4 can be any of the following:

[0039] Format 1, without param5: cmd4 10

[0040] Format 2, with param5: cmd4 10 100

[0041] In one embodiment, determining the subordinate relationship between elements represented by the configuration information in the cells based on the positional relationship between cells in the table may further include:

[0042] If a first cell containing configuration information is to the left of a second cell containing configuration information, there are no other cells containing configuration information between the first and second cells, and the first and second cells are in the same row, then the feature represented by the configuration information in the first cell is the parent feature of the feature represented by the configuration information in the second cell; and

[0043] If the first cell is not located in the leftmost column and there is no other configuration information to the left of the first cell in the same row, then the second element represented by the configuration information in the nearest cell above the first cell in the leftmost column is determined as the parent element of the first element represented by the configuration information in the first cell. If there is no configuration information above the first cell in the leftmost column, then the second element represented by the configuration information in the nearest cell above the second cell in the leftmost column is determined as the parent element of the first element represented by the configuration information in the first cell, and so on.

[0044] Table 2 below is a sample example of a form for user-filled configuration information.

[0045] C D E F G

[0046] Table 2

[0047] The parent element of an element is its left neighbor. If the left neighbor is empty, then the elements above it are considered until a suitable element is found. For example, in Table 1:

[0048] Element A is to the left of B, so A is the parent element of B;

[0049] Element A is located to the upper left of C, therefore A is the parent element of C;

[0050] Element C is to the left of D, so C is the parent element of D;

[0051] Element A is located to the upper left of element E, therefore A is the parent element of E.

[0052] If there is no configuration information to the left of element F, then the nearest element D above element F in the first column to the left is the parent element of element F.

[0053] If there is no configuration information to the left of element G, and there is no configuration information in the first column to the left of element G, then the nearest upper element F in the second column to the left of element G is the parent element of element G.

[0054] In one embodiment, the predefined rule may further include: in configuration information that begins with a second character, if a string exists after the second character, then the string indicates that a new view is entered after the command corresponding to the second character ends.

[0055] For example, as shown in Table 1, in the configuration information ">new_view" that begins with the predefined character ">", there is a string "new_view" after the predefined character ">", which indicates that a new view is entered after the command cmd1 corresponding to the predefined character ">" ends.

[0056] In one embodiment, a view can be an element that encompasses multiple commands, meaning each command is attached to a specific view. For example, in an XML file, a view is a child element of the root element, commands are child elements of the view, and parameters are child elements of the command. When the parent element of a parameter is also a parameter, then the parent element of its top-level parameter must be a command element.

[0057] In one embodiment, the predefined rule may further include: for configuration information in a cell, a string starting with the sixth character represents the range of parameter values.

[0058] For example, as shown in Table 1, in the configuration information “$INT@<1-5>#param1+”, the string “<1-5>” that begins with the specific character “@” (which is an example of the sixth character) indicates the range of values ​​for the parameter param1 (integers 1-5).

[0059] In one embodiment, the predetermined rule may further include: if the third element represented by the configuration information in the third cell and the fourth element represented by the configuration information in the fourth cell are both parameters, and the parent element of the third element and the fourth element is the same command element, then the third element and the fourth element represent different branches of the same command.

[0060] For example, as shown in Table 1, the third element represented by the configuration information "$STRING#param2" and the fourth element represented by the configuration information "$STRING#param3" are both parameters, and their parent element is an element of the same command cmd2. Therefore, the third and fourth elements represent different branches of the same command cmd2. That is, this indicates that the command cmd2 has the following two branches:

[0061] cmd2 param2; and

[0062] cmd2 param3.

[0063] The ">" after the configuration information "$STRING#param2" and "$STRING#param3" respectively indicates the end of different branches.

[0064] Unlike the above cases (representing different branches of a command), in the bottom row of Table 1, the configuration information "$INT@<10-20>#param4" is a sub-element of the configuration information "cmd4#second cmd", and "$INT@<2-9>#param5?" is a sub-element of the configuration information "$INT@<10-20>#param4". This indicates that parameters param5 and param4 are nested parameters. Accordingly, the command form for command cmd4 is as follows:

[0065] cmd4param4 param5

[0066] Figure 2 An example configuration file generated according to an embodiment of this disclosure is shown. This example configuration file is an XML configuration file, in which the main information is derived from Table 1 above, and the remaining information is fixed based on the actual application. In this configuration file, "repeat="true"" indicates that parameter param1 is a repeatable input parameter, and "optional="true"" indicates that parameter param5 is an optional parameter. This configuration file is used to render a user interface command line.

[0067] In this configuration file example, strings such as "help="first cmd" represent an attribute of an element in the configuration file, the specific meaning of which is determined by the program applying the configuration file. For example, in one embodiment, the help attribute can be used to prompt the user with the meaning of a parameter when the user executes the help function of the user interface command line.

[0068] By using the configuration file generation method described above according to this disclosure, the difficulty of manually editing software configuration files can be reduced, and the accuracy of the software configuration file format can be improved.

[0069] Figure 3 An exemplary configuration of a computing device 1200 capable of implementing embodiments of the present disclosure is shown.

[0070] Computing device 1200 is an example of a hardware device capable of applying the above aspects of this disclosure. Computing device 1200 can be any machine configured to perform processing and / or computation. Computing device 1200 can be, but is not limited to, a workstation, server, desktop computer, laptop computer, tablet computer, personal data assistant (PDA), smartphone, in-vehicle computer, or a combination thereof.

[0071] like Figure 3As shown, computing device 1200 may include one or more components that can be connected to or communicate with bus 1202 via one or more interfaces. Bus 1202 may include, but is not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus. Computing device 1200 may include, for example, one or more processors 1204, one or more input devices 1206, and one or more output devices 1208. The one or more processors 1204 may be any type of processor and may include, but is not limited to, one or more general-purpose processors or special-purpose processors (such as dedicated processing chips). Processor 1204 may, for example, be configured to implement the above-described table-based configuration file generation method. Input device 1206 may be any type of input device capable of inputting information to the computing device and may include, but is not limited to, a mouse, keyboard, touchscreen, microphone, and / or remote controller. Output device 1208 may be any type of device capable of presenting information and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer.

[0072] The computing device 1200 may also include or be connected to a non-transitory storage device 1214, which may be any non-transitory storage device capable of storing data, and may include, but is not limited to, disk drives, optical storage devices, solid-state storage, floppy disks, flexible disks, hard disks, magnetic tapes or any other magnetic media, compressed disks or any other optical media, cache memory and / or any other storage chip or module, and / or any other medium from which a computer may read data, instructions and / or code. The computing device 1200 may also include random access memory (RAM) 1210 and read-only memory (ROM) 1212. ROM 1212 may store executable programs, utilities, or processes in a non-volatile manner. RAM 1210 provides volatile data storage and stores instructions related to the operation of the computing device 1200. The computing device 1200 may also include a network / bus interface 1216 coupled to a data link 1218. Network / bus interface 1216 can be any kind of device or system capable of enabling communication with external devices and / or networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication devices and / or chipsets (such as Bluetooth). TM Equipment, 802.11 equipment, WiFi equipment, WiMax equipment, cellular communication facilities, etc.

[0073] This disclosure can be implemented as any combination of apparatus, system, integrated circuit, and computer program on a non-transitory computer-readable medium. One or more processors can be implemented as integrated circuits (ICs), application-specific integrated circuits (ASICs), or large-scale integrated circuits (LSIs), system LSIs, super LSIs, or ultra LSI components that perform some or all of the functions described in this disclosure.

[0074] This disclosure includes the use of software, application programs, computer programs, or algorithms. Software, application programs, computer programs, or algorithms may be stored on a non-transitory computer-readable medium to cause a computer, such as one or more processors, to perform the steps described above and in the accompanying drawings. For example, one or more memories may store the software or algorithm in executable instructions, and one or more processors may be associated with executing a set of instructions of the software or algorithm to provide various functionalities according to embodiments described in this disclosure.

[0075] Software and computer programs (also referred to as programs, software applications, applications, components, or code) include machine instructions for programmable processors and can be implemented in high-level procedural languages, object-oriented programming languages, functional programming languages, logic programming languages, assembly languages, or machine languages. The term "computer-readable medium" means any computer program product, apparatus, or device used to provide machine instructions or data to a programmable data processor, such as magnetic disks, optical disks, solid-state storage devices, memories, and programmable logic devices (PLDs), including computer-readable media that receive machine instructions as computer-readable signals.

[0076] For example, computer-readable media may include dynamic random access memory (DRAM), random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage devices, magnetic disk storage devices or other magnetic storage devices, or any other medium that can be used to carry or store required computer-readable program code in the form of instructions or data structures, and that can be accessed by a general-purpose or special-purpose computer or a general-purpose or special-purpose processor. As used herein, a disk or disc includes compact discs (CD), laser discs, optical discs, digital versatile discs (DVD), floppy disks, and Blu-ray discs, wherein a disk typically copies data magnetically, while a disc copies data optically using a laser. Combinations of the above are also included within the scope of computer-readable media.

[0077] The subject matter of this disclosure is provided as examples of apparatus, systems, methods, and programs for performing the features described herein. However, other features or variations are contemplated in addition to those described above. It is anticipated that the components and functions of this disclosure can be implemented using any emerging techniques that may replace any of the above-described implementations.

[0078] Furthermore, the above description provides examples and does not limit the scope, applicability, or configuration set forth in the claims. Changes may be made to the function and arrangement of the elements discussed without departing from the spirit and scope of this disclosure. Various processes or components may be appropriately omitted, substituted, or added in various embodiments. For example, features described with respect to certain embodiments may be combined in other embodiments.

[0079] Furthermore, in the description of this disclosure, the terms “first,” “second,” “third,” etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or order.

[0080] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring the operations to be performed in the specific order shown or in sequential order, or requiring the execution of all illustrated operations to achieve the desired result. In some cases, multitasking and parallel processing can be advantageous.

Claims

1. A method for generating configuration files based on tables, comprising: The configuration information is written into the table according to predetermined rules, which include: A configuration entry written in a cell of the table represents one of the following elements: a command in the configuration file, the end marker of the command in the configuration file, and a parameter in the configuration file; The attributes of the elements represented by the configuration information are determined according to the predetermined characters in the configuration information. For configuration information written in a cell of the table, configuration information starting with a first character represents the parameter, configuration information starting with a second character represents the end marker of the command, and configuration information starting with characters other than the first character and the second character represents the command. The program reads the configuration information written into the table; and The program generates the configuration file according to the predetermined rules and the read configuration information. The configuration file includes the commands and the parameters.

2. The method of claim 1, wherein, The pre-defined rules also include: Determine the hierarchical relationships between elements represented by the configuration information in the cells based on the positional relationships between the cells in the table.

3. The method of claim 1, wherein, The pre-defined rules also include: For configuration information in a cell, a string starting with the third character represents a description of the element.

4. The method of claim 1, wherein, The pre-defined rules also include: In the configuration information representing the parameters, The fourth character indicates that the parameter represented by this configuration information is a repeatable input parameter; and The fifth character indicates that the parameter represented by this configuration information is an optional parameter.

5. The method of claim 2, wherein, Determining the hierarchical relationships between elements represented by the configuration information in the cells, based on the positional relationships between cells in the table, also includes: If a first cell containing configuration information is to the left of a second cell containing configuration information, there are no other cells containing configuration information between the first and second cells, and the first and second cells are in the same row, then the feature represented by the configuration information in the first cell is the parent feature of the feature represented by the configuration information in the second cell; and If the first cell is not located in the leftmost column and there is no other configuration information to the left of the first cell in the same row, then the second element represented by the configuration information in the nearest cell above the first cell in the leftmost column is determined as the parent element of the first element represented by the configuration information in the first cell. If there is no configuration information above the first cell in the leftmost column, then the second element represented by the configuration information in the nearest cell above the second cell in the leftmost column is determined as the parent element of the first element represented by the configuration information in the first cell, and so on.

6. The method of claim 1, wherein, In configuration information that begins with the second character, if a string exists after the second character, then that string indicates that a new view will be entered after the command corresponding to the second character ends.

7. The method of claim 1, wherein, The pre-defined rules also include: For configuration information in a cell, the string starting with the sixth character indicates the range of parameter values.

8. The method according to claim 5, wherein, If the third element represented by the configuration information in the third cell and the fourth element represented by the configuration information in the fourth cell are both parameters, and the parent element of the third element and the fourth element is an element of the same command, then the third element and the fourth element represent different branches of the same command.

9. An apparatus for generating configuration files based on tables, comprising: A memory that stores instructions; as well as The processor is configured to execute instructions stored in the memory to perform the method according to any one of claims 1 to 8.

10. A computer-readable storage medium comprising computer-executable instructions, which, when executed by one or more processors, cause the one or more processors to perform the method according to any one of claims 1 to 8.