A method, system, storage medium and device for parsing and constructing an xml message
By converting XML messages to JSON format and automatically parsing and constructing target XML messages, the inefficiency and low accuracy caused by manual operation are solved, achieving efficient and automated XML message processing to meet the needs of different business scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- RONGHUI JINKE FINANCIAL SERVICE OUTSOURCING BEIJING CO LTD
- Filing Date
- 2023-04-03
- Publication Date
- 2026-05-08
AI Technical Summary
In existing technologies, the parsing and generation of XML messages rely on manual operation, resulting in low test accuracy and wasted human resources. Furthermore, the XML message format is inconsistently parsed on different servers, causing data duplication and maintenance difficulties.
By converting the original XML message into JSON format, extracting the target variables and parsing their information, constructing the target XML message according to the node configuration rules, and using automated scripts to replace manual operations, batch message parsing and variable combination are achieved.
It improves the accuracy and efficiency of XML message parsing and generation, reduces waste of human resources, reduces repetitive work, enhances testing efficiency and accuracy, and has good scalability and configurability.
Smart Images

Figure CN116582600B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and in particular to a method, system, storage medium, and device for parsing and constructing XML messages. Background Technology
[0002] XML (Extensible Markup Language) is a general-purpose markup language that can use a series of tags to describe data. It is a powerful tool for processing structured document information in the current fintech industry.
[0003] In practice, there is a business requirement to parse the original XML message and generate corresponding XML-formatted credit information messages for verifying the accuracy of test variables. The current processing method mainly involves test developers manually identifying and parsing the original message, and then manually combining and processing the message according to the requirements to output the final test message. The process and results are greatly affected by subjective human factors, resulting in low test accuracy. At the same time, it seriously wastes human resources and leads to low test efficiency. Summary of the Invention
[0004] Based on this, it is necessary to propose a method, system, storage medium, and device for parsing and constructing XML messages to address the above problems.
[0005] This invention discloses a method for parsing and constructing XML messages, the method comprising:
[0006] Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0007] Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0008] Parse the JSON variable file to obtain the variable information of the target variable;
[0009] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message.
[0010] Furthermore, the original XML message is obtained, and the message content corresponding to the target variable in the original XML message is converted into a JSON variable file, specifically including:
[0011] Obtain the original XML message path, and obtain the original XML message based on the original XML message path;
[0012] Convert the original XML message into a JSON format message;
[0013] According to the preset variable specification, the message content corresponding to the target variable is extracted from the JSON format message, and the JSON variable file of the target variable is saved.
[0014] Furthermore, the variable information includes: variable name and variable value;
[0015] Parse the JSON variable file to obtain the variable information of the target variable, specifically including:
[0016] Obtain the path to the JSON variable file, and retrieve the JSON variable file based on the path.
[0017] Parse the JSON variable file to obtain the variable name and variable value of the target variable.
[0018] Furthermore, the variable information also includes: attribute values;
[0019] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message, specifically including:
[0020] According to the node configuration rules, the target variable is configured as a variable node in the target XML message;
[0021] Select a variable node as the current variable node;
[0022] Based on the JSON variable file of the current variable node, determine whether the current variable node has attributes.
[0023] If there are attributes, then obtain the attribute value and variable value of the current variable node, and use them as the node value of the current variable node;
[0024] If there is no attribute, continue to determine whether the current variable node has child nodes. If there are child nodes, use the child nodes as the current variable node and return to the step of determining whether the current variable node has attributes. If there are no child nodes, obtain the variable value of the current variable node and use it as the node value of the current variable node.
[0025] Determine if the current variable node is the last variable node of the target XML message. If so, assemble all variable nodes and their corresponding node values to construct the target XML message. If not, select an unprocessed variable node as the current variable node and return to the step of determining if the current variable node has attributes, until the last variable node is processed.
[0026] On the other hand, the present invention also discloses a system for parsing and constructing XML messages, the system comprising:
[0027] The variable and rule determination module is used to determine the target variables and node configuration rules required to construct the target XML message based on business needs.
[0028] The raw message acquisition and conversion module is used to acquire the raw XML message and convert the message content corresponding to the target variable in the raw XML message into a JSON variable file.
[0029] The variable information parsing module is used to parse the JSON variable file to obtain the variable information of the target variable;
[0030] The target message construction module is used to configure the target variable as a variable node of the target XML message according to the node configuration rules, and to assemble the variable information of the target variable to construct the target XML message.
[0031] Furthermore, the original message acquisition and conversion module specifically includes:
[0032] The original message acquisition module is used to acquire the original XML message path and acquire the original XML message based on the original XML message path;
[0033] The format conversion module is used to convert the original XML message into a JSON format message;
[0034] The variable content extraction module is used to extract the message content corresponding to the target variable from the JSON format message according to the preset variable specification, and save it to generate the JSON variable file of the target variable.
[0035] Furthermore, the variable information includes: variable name and variable value;
[0036] The variable information parsing module specifically includes:
[0037] The variable file acquisition module is used to obtain the path of the JSON variable file and obtain the JSON variable file based on the path.
[0038] The variable information acquisition module is used to parse the JSON variable file to obtain the variable name and variable value of the target variable.
[0039] Furthermore, the variable information also includes: attribute values;
[0040] The target message construction module specifically includes:
[0041] The node configuration module is used to configure the target variable as a variable node in the target XML message according to the node configuration rules.
[0042] The current node selection module is used to select a variable node as the current variable node;
[0043] The node attribute determination module is used to determine whether the current variable node has attributes based on the JSON variable file of the current variable node;
[0044] The attribute node value acquisition module is used to acquire the attribute value and variable value of the current variable node as the node value of the current variable node when the node attribute judgment module determines that the current variable node has an attribute.
[0045] The child node judgment module is used to determine whether the current variable node has a child node when the node attribute judgment module determines that the current variable node has no attribute. If there is a child node, the child node is used as the current variable node, and the node attribute judgment module continues to determine whether the current variable node has an attribute. If there is no child node, the variable value of the current variable node is obtained and used as the node value of the current variable node.
[0046] The node traversal module is used to determine whether the current variable node is the last variable node of the target XML message. If so, it assembles all variable nodes and their corresponding node values to construct the target XML message. If not, it selects an unprocessed variable node as the current variable node through the current node selection module, and continues to determine whether the current variable node has attributes through the node attribute judgment module until the last variable node is processed.
[0047] On the other hand, the present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0048] Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0049] Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0050] Parse the JSON variable file to obtain the variable information of the target variable;
[0051] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message.
[0052] On the other hand, the present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0053] Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0054] Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0055] Parse the JSON variable file to obtain the variable information of the target variable;
[0056] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message.
[0057] The embodiments of the present invention have the following beneficial effects:
[0058] In this invention, the message content of the target variables required in the original XML message is extracted and converted into a corresponding JSON variable file. Then, the JSON variable file is parsed to obtain the variable information of the target variables. Finally, the target variables and their corresponding variable information are assembled to construct the target XML message. By adopting the XML-JSON-XML format, batch message parsing and variable combination processing are automatically realized, effectively avoiding the tedious work of repetitive and large-scale modification and saving of messages, reducing the waste of human resources, and improving work efficiency and accuracy. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] in:
[0061] Figure 1 This is a flowchart of a method for parsing and constructing XML messages in one embodiment;
[0062] Figure 2 This is a flowchart of step S2 in the method of parsing and constructing XML messages in one embodiment;
[0063] Figure 3 Here is a flowchart of step S3 of the method for parsing and constructing XML messages in one embodiment.
[0064] Figure 4 Here is a flowchart of step S4 of the method for parsing and constructing XML messages in one embodiment.
[0065] Figure 5 This is a structural block diagram of an XML message parsing and construction system in one embodiment;
[0066] Figure 6 This is a structural block diagram of the original message acquisition and conversion module 200 in an XML message parsing and construction system in one embodiment.
[0067] Figure 7 This is a structural block diagram of the variable information parsing module 300 in an XML message parsing and construction system in one embodiment.
[0068] Figure 8 This is a structural block diagram of the target message construction module 400 in an XML message parsing and construction system in one embodiment.
[0069] Figure 9 This is a structural block diagram of a computer device in one embodiment.
[0070] Figure labeling: Variable and rule determination module 100, original message acquisition and conversion module 200, original message acquisition module 210, format conversion module 220, variable content extraction module 230, variable information parsing module 300, variable file acquisition module 310, variable information acquisition module 320, target message construction module 400, node configuration module 410, current node selection module 420, node attribute judgment module 430, attribute node value acquisition module 440, child node judgment module 450, construction module 460. Detailed Implementation
[0071] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0072] like Figure 1 As shown in one embodiment, a method for parsing and constructing XML messages is provided, the method specifically including the following steps:
[0073] S1. Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0074] S2. Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0075] S3. Parse the JSON variable file to obtain the variable information of the target variable;
[0076] S4. According to the node configuration rules, configure the target variable as a variable node of the target XML message, and assemble the variable information of the target variable to construct the target XML message.
[0077] In the fintech industry, business processes are typically handled using XML messages. However, XML message exchange is characterized by massive data volume, high bandwidth consumption, complex parsing, and difficulty in maintenance. Furthermore, inconsistent parsing formats across different servers lead to significant data duplication. JSON, on the other hand, is a lightweight data exchange format with excellent readability and ease of rapid compilation. Its data format is simple, easy to read and write, consumes little bandwidth, and is easy to parse. Therefore, this application employs an "XML-JSON-XML" approach, first converting the original XML message into a JSON file, then processing and manipulating the relevant variables to construct the target XML message. This effectively avoids the tedious work of repeatedly modifying and saving numerous messages, thereby improving the efficiency and accuracy of message parsing and processing.
[0078] Furthermore, the method for parsing and constructing XML described in this application can effectively automate batch message parsing and variable combination processing. By replacing manual labor with automated scripts, it effectively reduces the waste of human resources and avoids the influence of subjective human factors on test results, thereby improving test efficiency and accuracy. In addition, the technical solution of this application has the characteristics of "high cohesion, low coupling, strong reusability, and high scalability," facilitating secondary development and possessing good configurability. It adopts a rapid deployment, rapid application, and rapid iteration approach to meet changes in resources and business processes, and can expand its application and performance as business develops and volume increases.
[0079] Furthermore, in one embodiment, such as Figure 2 As shown, step S2 specifically includes:
[0080] S21. Obtain the original XML message path, and obtain the original XML message based on the original XML message path;
[0081] S22. Convert the original XML message into a JSON format message;
[0082] S23. According to the preset variable specification, extract the message content corresponding to the target variable from the JSON format message and save it to generate the JSON variable file of the target variable.
[0083] The preset variable specification in this embodiment can be a specification that integrates variables from different periods and generations, such as first-generation variables, second-generation variables, etc. Through this variable specification, the required target variable content can be extracted from the JSON format file according to different variable identification and processing principles, so that the solution of this application can be applied to different business scenarios and has good application and performance expansion as the business develops and the business volume increases.
[0084] Furthermore, in one embodiment, the variable information includes: variable name and variable value;
[0085] like Figure 3 As shown, step S3 specifically includes:
[0086] S31. Obtain the path to the JSON variable file, and obtain the JSON variable file based on the path to the JSON variable file;
[0087] S32. Parse the JSON variable file to obtain the variable name and variable value of the target variable.
[0088] Furthermore, in one embodiment, the variable information also includes: attribute values;
[0089] like Figure 4 As shown, step S4 specifically includes:
[0090] S41. According to the node configuration rules, configure the target variable as a variable node of the target XML message;
[0091] S42. Select a variable node as the current variable node;
[0092] S43. Based on the JSON variable file of the current variable node, determine whether the current variable node has attributes. If it has attributes, execute step S43-1; if it has no attributes, execute step S43-2.
[0093] S43-1. Obtain the attribute value and variable value of the current variable node, and use them as the node value of the current variable node;
[0094] S43-2. Continue to determine whether the current variable node has child nodes. If it has child nodes, execute step S43-21. If it does not have child nodes, execute step S43-22.
[0095] S43-21. Set the child node as the current variable node and return to step S43;
[0096] S43-22. Obtain the variable value of the current variable node and use it as the node value of the current variable node;
[0097] S44. Determine whether the current variable node is the last variable node of the target XML message. If yes, execute step S44-1; otherwise, execute step S44-2.
[0098] S44-1. Assemble all variable nodes and their corresponding node values to construct the target XML message;
[0099] S44-2. Select a new unprocessed variable node as the current variable node and return to step S43 until the last variable node has been processed.
[0100] XML messages are typically constructed by configuring multiple variables as variable nodes. Below are some examples of variable node formats in XML messages:
[0101] 1. value ;
[0102] 2. ;
[0103] 3. <a property="value2”> value1 .
[0104] In the three formats above, the variable name of the variable node is A;
[0105] In the first format, and These are the start and end labels of variable A, respectively. (Start label) and closing tags The string "value" in the middle is the value of variable A;
[0106] In the second format, there are no variable values;
[0107] In the third format, variable A has a property, and the string value2 enclosed in double quotes on the right side of the property is the property value corresponding to the property, while the string value2 is the variable value of variable A.
[0108] In addition, such as Figure 5 As shown, in one embodiment, a system for parsing and constructing XML messages is also provided, the system comprising:
[0109] The variable and rule determination module 100 is used to determine the target variables and node configuration rules required to construct the target XML message based on business needs.
[0110] The original message acquisition and conversion module 200 is used to acquire the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file.
[0111] The variable information parsing module 300 is used to parse the JSON variable file to obtain the variable information of the target variable;
[0112] The target message construction module 400 is used to configure the target variable as a variable node of the target XML message according to the node configuration rules, and to assemble the variable information of the target variable to construct the target XML message.
[0113] Furthermore, such as Figure 6 As shown, in one embodiment, the original message acquisition and conversion module 200 specifically includes:
[0114] The original message acquisition module 210 is used to acquire the original XML message path and acquire the original XML message based on the original XML message path;
[0115] Format conversion module 220 is used to convert the original XML message into a JSON format message;
[0116] The variable content extraction module 230 is used to extract the message content corresponding to the target variable from the JSON format message according to the preset variable specification, and save the JSON variable file generated from the target variable.
[0117] Furthermore, in one embodiment, the variable information includes: variable name and variable value;
[0118] like Figure 7 As shown, the variable information parsing module 300 specifically includes:
[0119] The variable file acquisition module 310 is used to acquire the path of the JSON variable file and acquire the JSON variable file according to the path of the JSON variable file;
[0120] The variable information acquisition module 320 is used to parse the JSON variable file to obtain the variable name and variable value of the target variable.
[0121] Furthermore, in one embodiment, the variable information further includes: attribute values;
[0122] like Figure 8 As shown, the target message construction module 400 specifically includes:
[0123] The node configuration module 410 is used to configure the target variable as a variable node of the target XML message according to the node configuration rules.
[0124] The current node selection module 420 is used to select a variable node as the current variable node;
[0125] The node attribute judgment module 430 is used to determine whether the current variable node has attributes based on the JSON variable file of the current variable node;
[0126] The attribute node value acquisition module 440 is used to acquire the attribute value and variable value of the current variable node as the node value of the current variable node when the node attribute judgment module determines that the current variable node has an attribute.
[0127] The child node judgment module 450 is used to determine whether the current variable node has a child node when the node attribute judgment module 440 determines that the current variable node has no attribute. If there is a child node, the child node is used as the current variable node, and the node attribute judgment module 440 continues to determine whether the current variable node has an attribute. If there is no child node, the variable value of the current variable node is obtained and used as the node value of the current variable node.
[0128] The construction module 460 is used to determine whether the current variable node is the last variable node of the target XML message. If so, it assembles all variable nodes and their corresponding node values to construct the target XML message. If not, it selects an unprocessed variable node as the current variable node through the current node selection module 420, and continues to determine whether the current variable node has attributes through the node attribute judgment module 440 until the last variable node is processed.
[0129] Figure 9 An internal structural diagram of a computer device in one embodiment is shown. This computer device can specifically be a terminal or a server. Figure 9 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement methods for parsing and constructing XML messages. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to implement methods for parsing and constructing XML messages. Those skilled in the art will understand that… Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0130] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:
[0131] Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0132] Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0133] Parse the JSON variable file to obtain the variable information of the target variable;
[0134] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message.
[0135] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following steps:
[0136] Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message;
[0137] Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file;
[0138] Parse the JSON variable file to obtain the variable information of the target variable;
[0139] According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message.
[0140] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0141] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0142] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for parsing and constructing XML messages, characterized in that, The method includes: Based on business requirements, determine the target variables and node configuration rules needed to construct the target XML message; Obtain the original XML message and convert the message content corresponding to the target variable in the original XML message into a JSON variable file; the conversion of the message content corresponding to the target variable in the original XML message into a JSON variable file includes: converting the original XML message into a JSON format message; according to a preset variable specification, extracting the message content corresponding to the target variable from the JSON format message and saving it to generate the JSON variable file of the target variable; Parsing the JSON variable file to obtain the variable information of the target variable specifically includes: obtaining the path of the JSON variable file and obtaining the JSON variable file according to the path; parsing the JSON variable file to obtain the variable name and variable value of the target variable; the variable information includes: variable name, variable value, and attribute value; According to the node configuration rules, the target variable is configured as a variable node in the target XML message, and the variable information of the target variable is assembled to construct the target XML message. Specifically, this includes: configuring the target variable as a variable node in the target XML message according to the node configuration rules; selecting a variable node as the current variable node; determining whether the current variable node has attributes based on the JSON variable file of the current variable node; if it has attributes, obtaining the attribute value and variable value of the current variable node as the node value of the current variable node; if it has no attributes, continuing to determine whether the current variable node has child nodes; if it has child nodes, using the child nodes as the current variable node and returning to the step of determining whether the current variable node has attributes; if it has no child nodes, obtaining the variable value of the current variable node as the node value of the current variable node; determining whether the current variable node is the last variable node in the target XML message; if so, assembling all variable nodes and their corresponding node values to construct the target XML message; if not, selecting a new unprocessed variable node as the current variable node and returning to the step of determining whether the current variable node has attributes, until the last variable node is processed.
2. The method for parsing and constructing XML messages according to claim 1, characterized in that, Obtaining the raw XML message includes: Obtain the original XML message path, and obtain the original XML message based on the original XML message path.
3. A system for parsing and constructing XML messages, characterized in that, The system includes: The variable and rule determination module is used to determine the target variables and node configuration rules required to construct the target XML message based on business needs. The raw message acquisition and conversion module is used to acquire the raw XML message and convert the message content corresponding to the target variable in the raw XML message into a JSON variable file. The variable information parsing module is used to parse the JSON variable file to obtain the variable information of the target variable; The target message construction module is used to configure the target variable as a variable node of the target XML message according to the node configuration rules, and to assemble the variable information of the target variable to construct the target XML message; The original message acquisition and conversion module includes: The format conversion module is used to convert the original XML message into a JSON format message; The variable content extraction module is used to extract the message content corresponding to the target variable from the JSON format message according to the preset variable specification, and save it as a JSON variable file for the target variable. The variable information includes: variable name, variable value, and attribute value; The variable information parsing module specifically includes: The variable file acquisition module is used to obtain the path of the JSON variable file and obtain the JSON variable file based on the path. The variable information acquisition module is used to parse the JSON variable file to obtain the variable name and variable value of the target variable; The target message construction module specifically includes: The node configuration module is used to configure the target variable as a variable node in the target XML message according to the node configuration rules. The current node selection module is used to select a variable node as the current variable node; The node attribute determination module is used to determine whether the current variable node has attributes based on the JSON variable file of the current variable node; The attribute node value acquisition module is used to acquire the attribute value and variable value of the current variable node as the node value of the current variable node when the node attribute judgment module determines that the current variable node has an attribute. The child node judgment module is used to determine whether the current variable node has a child node when the node attribute judgment module determines that the current variable node has no attribute. If there is a child node, the child node is used as the current variable node, and the node attribute judgment module continues to determine whether the current variable node has an attribute. If there is no child node, the variable value of the current variable node is obtained and used as the node value of the current variable node. The construction module is used to determine whether the current variable node is the last variable node of the target XML message. If so, it assembles all variable nodes and their corresponding node values to construct the target XML message. If not, it selects an unprocessed variable node as the current variable node through the current node selection module, and continues to determine whether the current variable node has attributes through the node attribute judgment module until the last variable node is processed.
4. The system for parsing and constructing XML messages according to claim 3, characterized in that, The original message acquisition and conversion module also includes: The original message acquisition module is used to acquire the original XML message path and acquire the original XML message based on the original XML message path.
5. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the processor performs the steps of the method as described in any one of claims 1 to 2.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the computer program is executed by the processor, it causes the processor to perform the steps of the method as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Converting XML to JSON with configurable output
US20140244692A1