Code generation method and device for code-free development platform and storage medium

By performing compliance checks and code generation on the XML model of the codeless development platform on the server side, the problem of code injection risks in the B/S architecture is solved, and a secure code generation and verification process is realized.

CN119127197APending Publication Date: 2024-12-13CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310700694.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-13
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the B/S architecture's code-free development platform, the front-end generated code has the risk of code injection when executed on the back-end, resulting in security issues such as overprivileged access and system intrusion.

Method used

By obtaining the XML model sent by the browser on the server side, performing XML parsing and compliance checks, we ensure that only code matching the server-side logical block list is generated, exception code is excluded, and code injection is avoided.

Benefits of technology

It effectively avoids the risk of code injection, avoids the need to manually enter code on the server side, and realizes a safe code generation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127197A_ABST
    Figure CN119127197A_ABST
Patent Text Reader

Abstract

The invention provides a code generation method and device of a code-free development platform and a storage medium, and relates to the technical field of cloud computing. The method comprises the steps that an XML model sent by a browser side is acquired; performing XML analysis on the XML model to obtain a first character string list used for indicating a logic block type, and performing compliance check on the first character string list; the compliance check is used for checking whether a logic block type which does not belong to the server-side logic block list exists in the first character string list or not; if yes, determining that the inspection is unqualified; if not, determining that the inspection is qualified; and performing logic block objectification code generation on the XML model which is checked to be qualified according to a server-side logic block list. According to the method, the problem that code injection risks exist during transmission of the front end and the rear end can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a code generation method, device and storage medium for a codeless development platform. Background Art

[0002] The codeless development platform is a programming technology based on the B / S architecture (Browser / Server, front-end / back-end) and adopts the visual programming language (VPL) technology. Users can form a graphical programming codeless development platform by dragging and splicing the front-end preset logic units.

[0003] The logic diagram of visual programming technology is stored in the form of XML files, etc. XML is used as an example for explanation here: when a service is opened, the XML of the service is first obtained from the back end and handed over to the front end workspace for XML parsing, and the parsing result is matched with the block definition in the built-in logic block list to complete the conversion of graphical objects and visual rendering to form a logic diagram; when debugging, integration testing, and saving services, it is necessary to generate and store XML for the logic diagram, combine the code generator of the logic block to generate code, and then deliver the XML and the final code to the back end for storage; for calls between services that may occur during debugging and integration testing, the back end needs to directly obtain the code of the called service for calling.

[0004] However, from a security perspective, the way the front-end generates code and sends it to the back-end for execution poses a greater risk of script injection on the back-end. The back-end program is often unable to effectively verify the code provided by the front-end and can only passively accept and run it in its entirety. In some cases, this may lead to security issues such as unauthorized access and system intrusion. Summary of the invention

[0005] The present application provides a code generation method, device and storage medium for a codeless development platform, which are used to solve the problem of code injection risk during transmission between the front-end and the back-end.

[0006] In a first aspect, the present application provides a code generation method for a codeless development platform, which is applied to a server side, comprising:

[0007] Acquire an XML model sent by the browser; wherein the XML model is obtained by the browser converting the input logic block through the browser logic block list, and the browser logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks;

[0008] Performing XML parsing on the XML model to obtain a first string list for indicating the type of logic blocks, and performing a compliance check on the first string list; wherein the server-side logic block list of the server-side includes the logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, determining that the check is unqualified; if not, determining that the check is qualified;

[0009] For the XML model that passes the inspection, XML parsing is performed on the XML model and code generation is performed according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

[0010] In a possible design, performing compliance checking on the first string list includes:

[0011] According to the logic block type in the server-side logic block list, obtaining a second string list;

[0012] Determine whether there is a character string in the first character string list that does not belong to the second character string list; if so, determine that the check fails; if so, determine that the check passes.

[0013] In a possible design, the XML model is parsed and code is generated according to the server-side logic block list, including:

[0014] Performing XML parsing on the XML model to obtain a third string list, wherein the third string list includes logic blocks and logic block feature information;

[0015] Objectification and code generation are performed on the logic blocks in the third string list according to the server-side logic block list and the logic block feature information; wherein the server-side logic block list also includes block definitions corresponding to the logic blocks, the block definitions can objectify the logic blocks, and the code generator can generate codes.

[0016] In a possible design, performing XML parsing on the XML model to obtain a third string list includes:

[0017] The XML model is parsed to obtain a DOM tree, and the character string corresponding to each logic block in the DOM tree is extracted to generate the third character string list, wherein the third character string list includes the logic blocks, the dynamic attributes of the logic blocks, and the hierarchical relationship between the logic blocks.

[0018] In a possible design, the logic block feature information includes dynamic properties of the logic block and hierarchical relationships between the logic blocks, and objectifying and generating codes for the logic blocks in the third string list according to the server-side logic block list and the logic block feature information includes:

[0019] Objectifying the logic blocks in the third string list according to the block definition of the server, and obtaining the logic block object; if there is a dynamic logic block object, adding the dynamic attribute value of the logic block in the third string list to the logic block object;

[0020] According to the code generator corresponding to the logic block object, a code snippet is generated; according to the hierarchical relationship between the logic blocks, the code snippets are combined to generate a complete code.

[0021] In a possible design, the performing XML parsing on the XML model to obtain a first string list for indicating the logic block type includes:

[0022] The XML model is parsed to obtain a DOM tree, and a character string corresponding to each logical block type in the DOM tree is extracted to generate a first character string list.

[0023] In one possible design, after determining that the inspection is unqualified, the method further includes:

[0024] For the first string list that fails the check, the first string list and the XML model corresponding to the first string are thrown out as abnormal files.

[0025] In a second aspect, the present application provides a code generation device for a codeless development platform, which is applied to a server side, and the device includes:

[0026] An acquisition module is used to acquire an XML model sent by a browser; wherein the XML model is obtained by converting an input logic block by the browser through a browser logic block list, wherein the browser logic block list includes a plurality of logic blocks and block definitions corresponding to the logic blocks;

[0027] A compliance check module is used to perform XML parsing on the XML model to obtain a first string list for indicating a logic block type, and perform a compliance check on the first string list; wherein the server-side logic block list of the server-side includes the logic block in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, it is determined that the check is unqualified; if not, it is determined that the check is qualified;

[0028] The code generation module is used for performing XML parsing on the XML model that has passed the inspection and generating code according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

[0029] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0030] The memory stores computer-executable instructions;

[0031] The processor executes the computer-executable instructions stored in the memory to implement a code generation method for a codeless development platform.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, and the computer execution instructions, when executed by a processor, are used to implement a code generation method for a codeless development platform.

[0033] The code generation method, device and storage medium of the codeless development platform provided by the present application obtain the XML model sent by the browser, parse the XML model and perform compliance check, wherein the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, it is determined that the check is unqualified; if not, it is determined that the check is qualified; the code generator is used to generate code for the XML model that has passed the check. The following technical effects are achieved:

[0034] This avoids the situation in a B / S architecture codeless development platform where, after code generation on the browser side, the server side needs to rely on a process designer. For the parts that the designer cannot implement, the developer needs to manually enter the code to provide logic fragments. The code generation is done in a template manner, and language-level codeless generation cannot be achieved.

[0035] The present invention obtains the XML model sent by the browser, parses the XML model and performs compliance check, excludes abnormal codes or files, and generates code in the background for qualified XML models, thereby avoiding possible code injection problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 An application scenario diagram of the code generation method for the codeless development platform provided in this application;

[0038] Figure 2 Schematic diagram of the code generation method of the codeless development platform provided for this application Figure 1 ;

[0039] Figure 3 Schematic diagram of the code generation method of the codeless development platform provided for this application Figure 2 ;

[0040] Figure 4 This is a schematic diagram of the process of calling services in the integration test in this embodiment. Figure 3 ;

[0041] Figure 5 A schematic diagram of the structure of a code generation method and device for a code-free development platform provided in this application;

[0042] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation methods described in the following exemplary embodiments do not represent all implementation methods consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims, rather than all embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0044] The code generation method of the codeless development platform provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. It should be noted that the "at..." in the embodiment of the present application can be the instant when a certain situation occurs, or it can be a period of time after a certain situation occurs, and the embodiment of the present application does not specifically limit this.

[0045] Figure 1 This is an application scenario diagram of the code generation method of the codeless development platform provided in the embodiment of the present application. Figure 1 As shown, the present application is a code-free development platform for a B / S architecture, and the development platform used in the present application includes a browser-side platform (also referred to as a front-end) and a server-side platform (also referred to as a back-end).

[0046] The codeless development platform in the present invention specifically refers to a codeless development platform for backend service development. An application developed by the platform corresponds to a Java application based on the Spring Boot framework. An actual software project or system can be composed of applications in multiple platforms. Spring Boot is a common development framework using the Java language. Applications developed based on Spring Boot manage Java objects required by the application in the application context. A plug-in is a common tool function extension method in a development tool, which provides function extensions for applications by providing code snippets or aggregated function combinations. The codeless development platform plug-in implementation method in the present invention specifically refers to an independent file form, and the specified plug-in file is dynamically loaded when the application is running to complete a specific function.

[0047] The browser side mainly covers XML parsing and XML generation capabilities. The XML parsing interacts with the built-in logic block list in the workspace to support graphical rendering of logic blocks, including dynamic rendering such as drop-down selection and linkage operation. The browser-side logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks. When generating services, technicians open services on the browser side, select logic blocks in the logic block list and drag them. The browser-side block definition is restored and rendered according to the technicians' dragging operations to generate logic diagrams and convert the logic diagrams into XML models. The XML model is sent to the server side.

[0048] The main work on the server side is compliance checking and code generation. The compliance check is used to check whether the received file is the XML model sent by the browser. When it is confirmed that the file does not belong to the file sent by the browser, an exception is thrown, which effectively avoids the risk of code injection. The file sent by the browser throws an exception, and the code is generated for the file sent by the browser. The logic blocks included in the server-side logic block list on the server side are the same as the logic blocks and block definitions in the browser-side logic block list, and can be used for compliance checking. The difference is that the logic blocks in the server-side logic block list also include the code generator corresponding to the logic blocks in the server-side logic block list, which is used for code generation; the generated code can be debugged and tested on the server side.

[0049] Figure 2 Schematic diagram of the code generation method of the codeless development platform provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the method is applied to the server, including:

[0050] S201, obtaining an XML model sent by the browser, wherein the XML model is obtained by the browser by converting the input logic block through the browser logic block list, and the browser logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks;

[0051] Specifically, the browser side mainly covers XML parsing and XML generation capabilities. The XML parsing interacts with the built-in logic block list in the workspace to support graphical rendering of logic blocks, including dynamic rendering such as drop-down selection and linkage operation;

[0052] Specifically, the browser-side logic block list includes multiple logic blocks, each logic block has a corresponding block definition, and the block definition has the ability to restore and render, that is, it has the function of restoring the logic block dragged by the technician into a logic block object, and the block definition also has the function of rendering the logic block object.

[0053] Specifically, the technician opens the service on the browser side, selects the logic block in the logic block list and drags it. The block definition on the browser side generates a logic block object from the logic block. The technician further drags the logic block object to add dynamic properties of the logic block object, logical relationships between logic block objects, etc. The block definition on the browser side renders and generates a logic diagram based on the dynamic properties of the logic block object, logical relationships between logic block objects, etc. added by the technician, and converts the logic diagram into an XML model in XML format.

[0054] S202, performing XML parsing on the XML model to obtain a first string list for indicating a logic block type, and performing a compliance check on the first string list; wherein the server-side logic block list of the server side includes logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, determining that the check is unqualified; if not, determining that the check is qualified;

[0055] Specifically, the first string list is used to store the types of all logic blocks in the XML model.

[0056] Specifically, the logic blocks stored in the server-side logic block list are the same as the logic blocks and block definitions stored in the browser-side logic block list. The difference is that the logic blocks in the server-side logic block list also include the code generators corresponding to the logic blocks in the browser-side logic block list.

[0057] Specifically, the compliance check is used to check whether the file received by the server is the XML model sent by the browser. If it is determined that the file is the XML model sent by the browser, the check is qualified; if it is determined that the file is not the XML model sent by the browser, the check fails and the file is an external injection code.

[0058] As its principle, if the logic blocks stored in the browser-side logic list are the same as those stored in the server-side logic list, the XML model will be parsed into various logic blocks (expressed in the form of strings); if the logic block types in the XML model all belong to the logic block types stored in the server-side logic list / browser-side logic list, it is considered that the XML model obtained by the server-side comes from the browser; if it is found that at least one logic block type in the logic block type in the XML model does not belong to the logic block type stored in the server-side logic list / browser-side logic list, it is determined that the XML model obtained by the server-side does not come from the browser, but is an external injection code.

[0059] S203: For the XML model that has passed the inspection, perform XML parsing on the XML model and generate code according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

[0060] Specifically, for the XML model corresponding to the first string list that has passed the inspection, the corresponding third string list in the XML model is obtained, and the third string list includes logic blocks and logic block feature information; logic block objectification code is generated according to the server-side logic block list and the third string list; wherein the server-side logic block list also includes block definitions and code generators corresponding to the logic blocks, the block definitions can objectify the logic blocks in the second string list, and the code generator can generate code according to the logic block feature information.

[0061] The method provided in this embodiment obtains the XML model sent by the browser, parses the XML model and performs compliance check. The compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if it exists, it is determined that the check is unqualified; if not, it is determined that the check is qualified; the code generator is used to generate code for the XML model that has passed the check. The following technical effects are achieved:

[0062] This avoids the situation in a B / S architecture codeless development platform where, after code generation on the browser side, the server side needs to rely on a process designer. For the parts that the designer cannot implement, the developer needs to manually enter the code to provide logic fragments. The code generation is done in a template manner, and language-level codeless generation cannot be achieved.

[0063] The present invention obtains the XML model sent by the browser, parses the XML model and performs compliance check, excludes abnormal codes or files, and generates code in the background for qualified XML models, thereby avoiding possible code injection problems.

[0064] Figure 3 Schematic diagram of the code generation method of the codeless development platform Figure 2 .like Figure 3 As shown, the method includes:

[0065] S301, obtaining the XML model sent by the browser;

[0066] Specifically, the XML model is obtained by converting the input logic block through the browser-side logic block list, and the browser-side logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks;

[0067] The specific steps are similar to those in S201 and will not be repeated here.

[0068] S302: Perform XML parsing on the XML model to obtain a DOM tree, and extract the character string corresponding to each logical block type in the DOM tree to generate a first character string list.

[0069] Specifically, the first string list is used to save the types of all logic blocks in the XML model. XML parsing is used to obtain the DOM tree. The DOM tree can intuitively represent the logic blocks, the types corresponding to the logic blocks, dynamic attributes, hierarchical relationships, etc. in the form of strings. The strings corresponding to all logic block types are extracted to generate the first string list.

[0070] S303, perform compliance check on the first string list; if the check fails, execute S304; if the check passes, execute S305;

[0071] Specifically, the server-side logic block list includes logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, it is determined that the check is unqualified; if not, it is determined that the check is qualified;

[0072] As a preferred solution, S303 includes the following steps:

[0073] S3031. Obtain a second string list according to the logic block type in the server-side logic block list;

[0074] Specifically, the logic block types in the server-side logic block list are extracted and converted into a string form to generate a second string list.

[0075] S3032, determining whether there is a character string in the first character string list that does not belong to the second character string list;

[0076] S3033 If it exists, it is determined that the inspection fails; if it exists, it is determined that the inspection passes.

[0077] Specifically, S3031-S3033, the logic block type in the server-side logic block list is stringified to generate a second string list. It is only necessary to determine whether there is a string in the first string list that does not belong to the second string list to determine whether the logic block type in the XML model belongs to the type of the logic block in the server-side logic block list, thereby determining whether there is code injection.

[0078] S304, throwing the first string list and the XML model corresponding to the first string as abnormal files;

[0079] Specifically, if at least one of the logic block types in the XML model is found to not belong to the logic block type stored in the server-side logic list / browser-side logic list, it is determined that the XML model obtained by the server-side does not come from the browser side and is an external injection code, and an exception is thrown for its related files, thereby eliminating the risk of code injection.

[0080] S305, performing XML parsing on the XML model to obtain a third string list;

[0081] Specifically, the step of obtaining a DOM tree by XML parsing of the XML model has been performed in S302, and the string corresponding to each logic block in the DOM tree is directly extracted to generate a third string list, and the third string list includes the logic blocks, dynamic attributes of the logic blocks and the hierarchical relationship between the logic blocks;

[0082] Specifically, for the XML model that has passed the inspection, it is determined that code generation can be performed on the server side. As a preparatory step for code generation, strings corresponding to the logic blocks, dynamic attributes of the logic blocks, and hierarchical relationships between the logic blocks can be directly extracted from the DOM tree obtained in S302 to generate a third string list;

[0083] S306, objectifying and generating codes for the logic blocks in the third string list according to the server-side logic block list and the logic block feature information;

[0084] Specifically, the logic blocks in the third string list are objectified according to the block definition on the server side to obtain the logic block object; if there is a dynamic logic block object, the dynamic attribute value of the logic block in the third string list is added to the logic block object; according to the code generator corresponding to the logic block object, a code snippet is generated; according to the hierarchical relationship between the logic blocks, the code snippets are combined to generate a complete code.

[0085] Specifically, the hierarchical relationship between the logic blocks is used to describe the logical relationship between the logic blocks. According to the order of the logical relationship, the logic blocks in the third string list can be objectified using block definition to obtain the logic block objects, and a code generator can be used to generate code snippets; then the code generator combines the code snippets to generate complete code according to the hierarchical relationship between the logic blocks.

[0086] Specifically, when objectifying, if there are dynamic tags (i.e., dynamic attributes in the third string) in the current logic block, such as drop-down selection, linkage operation, etc., the corresponding tag values ​​are assigned to the logic block object through static tags, such as labels; elements that may dynamically change the performance of the logic block are replaced by static elements, which can avoid exceptions caused by the non-existence of options during restoration, thereby supporting rendering-free restoration of logic block objects.

[0087] In this step, the block definition on the server side does not need to support operations that require rendering, such as dynamic data linkage. Through dynamic tag conversion, the dependence on code front-end generation caused by the reliance on visual programming technology and dynamic effects of logic blocks in the codeless development platform is effectively solved.

[0088] Specifically, after the code is generated, subsequent debugging and integration testing can be performed. Figure 4 This is a schematic diagram of the process of calling services in the integration test in this embodiment. Figure 3 ,like Figure 4 , the service calls in debugging and integration testing specifically include:

[0089] a. Start debugging: The processing steps for debugging and integration testing are similar. Debugging is used as an example for description. When debugging starts, necessary processing of the debugging input parameters is required, such as formatting and data type conversion.

[0090] The specific debugging process is a recursive calling process consisting of five steps of bh:

[0091] b. Receive the service logic diagram to be debugged: receive the service logic diagram passed in as a text in XML format;

[0092] c. Obtaining the service code to be debugged: The code generated in S307 is the code of the service to be debugged;

[0093] d. Debugging statement by statement: If there are undebugged statements in the code of the service to be debugged, get the next statement;

[0094] e. Query the logic diagram of the called service: If the current statement is to call another service, query the logic diagram of the called service, that is, XML, and then recursively reenter the debugging process to complete the execution of the called service by S2-S7;

[0095] f. Complete statement execution: The current statement is executed, the statement execution result is obtained, and the next statement is ready to be executed. Here, when the service is called, it will wait for the called service to be executed;

[0096] g. Return debugging results: During the debugging process, mark the current service to be debugged as completed and return the return value of the service to the superior process;

[0097] h. Return debugging results: In the recursive outermost debugging task, complete debugging, obtain the return value and debugging results of the service to be debugged, and return the debugging results to the superior process.

[0098] By using the method provided in this embodiment, the following technical effects can be achieved:

[0099] This avoids the situation in a B / S architecture codeless development platform where, after code generation on the browser side, the server side needs to rely on a process designer. For the parts that the designer cannot implement, the developer needs to manually enter the code to provide logic fragments. The code generation is done in a template manner, and language-level codeless generation cannot be achieved.

[0100] The present invention obtains the XML model sent by the browser, parses the XML model and performs compliance check, excludes abnormal codes or files, and generates code in the background for qualified XML models, thereby avoiding possible code injection problems.

[0101] During code generation, if there are dynamic tags in the logic block, they will be statically assigned and added to the logic block object, and then code will be generated for the logic block object, so that the block definition on the server side does not need to support dynamic data linkage and other operations that require rendering. Through dynamic tag conversion, the dependence on code front-end generation caused by reliance on visual programming technology and dynamic effects of logic blocks in the codeless development platform is effectively solved.

[0102] The present invention solves the problem that the backend lacks browser core support and cannot directly complete core functions such as logic diagram analysis, logic block display, linkage control, etc. that can be completed by front-end JavaScript, thereby making it difficult to generate code on the backend.

[0103] The embodiment of the present invention can divide the electronic device or the main control device into functional modules according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a structural diagram of a code generation device of a codeless development platform.

[0104] Figure 5 A schematic diagram of a code generation method device for a codeless development platform, such as Figure 5 As shown, the device 50 is a device applied to the server, and the device 50 includes:

[0105] The acquisition module 501 is used to acquire the XML model sent by the browser end; wherein the XML model is obtained by the browser end converting the input logic block through the browser end logic block list, and the browser end logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks;

[0106] The compliance check module 502 is used to perform XML parsing on the XML model to obtain a first string list for indicating the type of logic blocks, and perform compliance check on the first string list; wherein the server-side logic block list of the server side includes the logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type that does not belong to the server-side logic block list in the first string list; if so, it is determined that the check fails; if not, it is determined that the check passes;

[0107] The code generation module 503 is used to parse the XML model that has passed the inspection and generate code according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

[0108] Furthermore, the compliance checking module 502 is specifically used to:

[0109] According to the logic block type in the server-side logic block list, obtain a second string list;

[0110] It is determined whether there is a character string in the first character string list that does not belong to the second character string list; if so, it is determined that the check fails; if so, it is determined that the check passes.

[0111] Furthermore, the code generation module 503 is specifically used for:

[0112] Performing XML parsing on the XML model to obtain a third string list, the third string list including logic blocks and logic block feature information;

[0113] The logic blocks in the third string list are objectified and code generated according to the server-side logic block list and logic block feature information; wherein the server-side logic block list also includes block definitions corresponding to the logic blocks, the block definitions can objectify the logic blocks, and the code generator can generate code.

[0114] Furthermore, the code generation module 503 is also specifically used for:

[0115] The XML model is parsed to obtain a DOM tree, and the character string corresponding to each logic block in the DOM tree is extracted to generate a third character string list, wherein the third character string list includes the logic blocks, dynamic attributes of the logic blocks, and the hierarchical relationship between the logic blocks.

[0116] Furthermore, the code generation module 503 is also specifically used for:

[0117] Objectifying the logic blocks in the third string list according to the block definition of the server, and obtaining the logic block object; if there is a dynamic logic block object, adding the dynamic attribute value of the logic block in the third string list to the logic block object;

[0118] Generate code snippets according to the code generator corresponding to the logic block object; combine the code snippets to generate complete code according to the hierarchical relationship between the logic blocks.

[0119] Furthermore, the compliance checking module 502 is further configured to:

[0120] The XML model is parsed to obtain a DOM tree, and a character string corresponding to each logical block type in the DOM tree is extracted to generate a first character string list.

[0121] Furthermore, the compliance checking module 502 is further configured to:

[0122] For the first string list that fails the check, the first string list and the XML model corresponding to the first string are thrown as exception files.

[0123] The code generation device of a codeless development platform provided in this embodiment can execute the code generation method of a codeless development platform of the above embodiment, and its implementation principle and technical effect are similar, which will not be repeated in this embodiment.

[0124] In the specific implementation of the code generation device of the aforementioned codeless development platform, each module can be implemented as a processor, and the processor can execute computer execution instructions stored in the memory, so that the processor executes the code generation method of the aforementioned codeless development platform.

[0125] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown, the electronic device 60 includes: at least one processor 601 and a memory 602. The electronic device 60 also includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus 604.

[0126] In the specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, so that at least one processor 601 executes a code generation method of a codeless development platform executed by the electronic device side as above.

[0127] The specific implementation process of the processor 601 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0128] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0129] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.

[0130] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0131] The above-mentioned functions implemented by the electronic device and the main control device introduce the scheme provided by the embodiment of the present invention. It can be understood that in order to implement the above-mentioned functions, the electronic device or the main control device includes a hardware structure and / or software module corresponding to the execution of each function. In combination with the units and algorithm steps of each example described in the embodiment disclosed in the embodiment of the present invention, the embodiment of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present invention.

[0132] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, a code generation method for a code-free development platform as described above is implemented.

[0133] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0134] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in an electronic device or a main control device.

[0135] The present application also provides a computer program product, which includes: a computer program, which is stored in a readable storage medium. At least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0136] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A code generation method for a codeless development platform, characterized in that: Applied to the server side, the method includes: Acquire an XML model sent by the browser; wherein the XML model is obtained by the browser converting the input logic block through the browser logic block list, and the browser logic block list includes multiple logic blocks and block definitions corresponding to the logic blocks; Performing XML parsing on the XML model to obtain a first string list for indicating the type of logic blocks, and performing a compliance check on the first string list; wherein the server-side logic block list of the server-side includes the logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, determining that the check is unqualified; if not, determining that the check is qualified; For the XML model that passes the inspection, XML parsing is performed on the XML model and code generation is performed according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

2. The method according to claim 1, characterized in that The performing compliance checking on the first string list includes: According to the logic block type in the server-side logic block list, obtaining a second string list; Determine whether there is a character string in the first character string list that does not belong to the second character string list; if so, determine that the check fails; if so, determine that the check passes.

3. The method according to claim 1, characterized in that The step of performing XML parsing on the XML model and generating code according to the server-side logic block list includes: Performing XML parsing on the XML model to obtain a third string list, wherein the third string list includes logic blocks and logic block feature information; Objectification and code generation are performed on the logic blocks in the third string list according to the server-side logic block list and the logic block feature information; wherein the server-side logic block list also includes block definitions corresponding to the logic blocks, the block definitions can objectify the logic blocks, and the code generator can generate codes.

4. The method according to claim 3, characterized in that The step of performing XML parsing on the XML model to obtain a third string list includes: The XML model is parsed to obtain a DOM tree, and the character string corresponding to each logic block in the DOM tree is extracted to generate the third character string list, wherein the third character string list includes logic blocks, dynamic attributes of the logic blocks, and hierarchical relationships between the logic blocks.

5. The method according to claim 3, characterized in that: The logic block feature information includes dynamic properties of the logic block and hierarchical relationships between the logic blocks, and objectifying and generating codes for the logic blocks in the third string list according to the server-side logic block list and the logic block feature information includes: Objectifying the logic blocks in the third string list according to the block definition of the server, and obtaining the logic block object; if there is a dynamic logic block object, adding the dynamic attribute value of the logic block in the third string list to the logic block object; According to the code generator corresponding to the logic block object, a code snippet is generated; according to the hierarchical relationship between the logic blocks, the code snippets are combined to generate a complete code.

6. The method according to claim 1, characterized in that The step of performing XML parsing on the XML model to obtain a first string list for indicating the type of logic blocks includes: The XML model is parsed to obtain a DOM tree, and a character string corresponding to each logical block type in the DOM tree is extracted to generate a first character string list.

7. The method according to any one of claims 1 to 6, characterized in that: After determining that the inspection is unqualified, the method further includes: For the first string list that fails the check, the first string list and the XML model corresponding to the first string are thrown out as abnormal files.

8. A code generation device for a codeless development platform, characterized in that: Applied to the server side, including: An acquisition module is used to acquire an XML model sent by a browser; wherein the XML model is obtained by converting an input logic block by the browser through a browser logic block list, wherein the browser logic block list includes a plurality of logic blocks and block definitions corresponding to the logic blocks; A compliance check module is used to perform XML parsing on the XML model to obtain a first string list for indicating a logic block type, and perform a compliance check on the first string list; wherein the server-side logic block list of the server-side includes the logic blocks in the browser-side logic block list, and the compliance check is used to check whether there is a logic block type in the first string list that does not belong to the server-side logic block list; if so, it is determined that the check is unqualified; if not, it is determined that the check is qualified; The code generation module is used for performing XML parsing on the XML model that has passed the inspection and generating code according to the server-side logic block list, wherein the server-side logic block list includes code generators corresponding to the logic blocks.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.