Method and device for storing messages based on structured documents

By using a structured document-based message entry method and a tree-structured approach to automate message entry, the problem of low efficiency in message format adjustment and access in the second-generation payment system was solved, achieving efficient and flexible message data processing.

CN112785284BActive Publication Date: 2024-09-17BEIJING CHIBO INFORMATION ENG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011636713.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2024-09-17
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

In the second-generation payment system, existing technologies suffer from problems such as low efficiency in revising message format standards and manual data entry, and long message structure verification time when handling message format adjustments and access to new business platforms.

Method used

The method adopts a structured document-based approach. By reading the messages to be entered into the database, extracting table content according to the element structure of the preset template file, constructing an element structure set, and using a tree structure to enter the messages into the database, including configuring the loading method of the preset template file and node types, the automated entry of messages into the database is achieved.

Benefits of technology

It improves the efficiency of message maintenance and initial data entry preparation, simplifies manual workflows, enhances the flexibility and accuracy of message assembly, and adapts to the verification needs of various business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112785284B
    Figure CN112785284B
Patent Text Reader

Abstract

The present application provides a message storage method and device based on structured documents. The present invention saves a lot of manual work and shortens the workflow, thereby improving the efficiency of the early storage preparation for message maintenance. Secondly, compared with directly extracting documents into arrays and linked lists, tree structures are easier to cut and graft, which solves the problem of assembling the same message type message body structure but combining different details, additional fields to verify one or more details, different business types and business categories, etc. according to a message type carrier when X (= dozens to hundreds) message types are newly added or updated. Business scenario verification; in particular, when dozens of message structures correspond to the same business category but different business types, the same business category message body structure is extracted, or a repeatable unit structure is marked, etc., which improves the user's customization of the assembled message structure when the message is assembled and sent, and improves the efficiency and flexibility of the message in the business verification stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, in particular to the field of artificial intelligence technology, and specifically to a method and device for storing messages based on structured documents. Background Art

[0002] In China's second-generation payment system (CNAPS) and payment message transmission platform, the messages for business interaction between commercial bank participants, third-party payment and clearing systems, and various business platforms are sent and received and processed in the extensible markup language (XML) format. Here, the message formats of the first-generation payment system are CMT and PKG. In response to the needs of system adjustment and access to new business platforms in the second-generation payment system, the corresponding message format standard document will revise the newly added and adjusted message types and business descriptions, etc. The message format standard specifies the corresponding message types for each business transaction.

[0003] During the development and testing process, Figure 1 As shown, the acceptance data of this type of business needs to be assembled into an Extensible Markup Language (XML) message or a CMT format message according to the provided message format standard and sent to the simulation test environment for testing. It is based on the needs of this type of test business that a method has been developed to convert the message format standard document into a message structure element set based on Extensible Markup Language (XML) and CMT format and import it into a database table. This method effectively improves work efficiency. For example, it eliminates the tedious manual entry of Extensible Markup Language (XML) and CMT message elements and reduces the time process for message structure proofreading caused by frequent adjustments during the development phase. According to the newly added corresponding subsystem type, the message format standard and the corresponding overview document file are imported, and the message structure data information can be stored in the library, and the corresponding message structure based on Extensible Markup Language (XML) and CMT can be maintained through the page.

[0004] The technology used to develop this method is Java technology and the parsing technology of "Microsoft Office format documents based on the API provided by Apache POI". Through the conversion method of this patent, multiple message types, where the message type consists of dozens to hundreds of tag objects, can be organized into a message structure view based on the Extensible Markup Language (XML) and stored in the library. Summary of the invention

[0005] In order to solve the above technical problems, this application provides the following technical solutions:

[0006] In a first aspect, a method for storing messages based on structured documents includes:

[0007] Read the message to be stored;

[0008] Extract the table content of each element structure of the message to be stored corresponding to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure;

[0009] The message is stored in the database according to the extracted element structure set.

[0010] In a preferred embodiment, it also includes:

[0011] Configure the preset template file.

[0012] In a preferred embodiment, configuring the preset template file includes:

[0013] Configuring the element structure and tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is one of the nodes of the preset template file;

[0014] Configure the properties of each node and table according to actual business needs.

[0015] In a preferred embodiment, the element structure is a hierarchical structure, and each level is a node of the tree structure;

[0016] The step of extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file includes:

[0017] Load the preset template file and traverse all nodes therein;

[0018] Load each node according to the type of each node in a loading method corresponding to each node type;

[0019] The element structure set is obtained according to the loaded node extraction.

[0020] In a preferred embodiment, the nodes include: a title node, a text node, a table node, and a picture node.

[0021] In a preferred embodiment, the step of loading each node in a loading manner corresponding to each node type according to the type of each node includes:

[0022] If the node type is a title node, locate the specific document location according to the title content in the template node;

[0023] Whether log information needs to be output is determined according to the optional state of the attribute of the node.

[0024] In a preferred embodiment, the step of loading each node in a loading manner corresponding to each node type according to the type of each node includes:

[0025] If the node type is a text node, read the text content corresponding to the description part in the document;

[0026] According to the node definition in the template, the read text content is saved in the corresponding data structure.

[0027] In a preferred embodiment, the step of loading each node in a loading manner corresponding to each node type according to the type of each node includes:

[0028] If the type of the node is a table node, verify whether the table at the corresponding position in the document complies with the template definition according to the table columns defined in the template;

[0029] If it does, extract the table structure and determine whether the column name complies with the table template definition;

[0030] If it matches, the table column data is read according to the template file definition.

[0031] In a preferred embodiment, extracting and obtaining the element structure set according to the loaded nodes includes:

[0032] Read the table data content into the defined data structure elements, where a table row data corresponds to an element data structure, and a table corresponds to an element data structure list;

[0033] When a structure domain referenced by a tag element is a table structure defined in another document, the table data of another file is read, and the tag element is replaced by a plurality of tags and sub-tag elements defined in a corresponding tag structure in the other file;

[0034] When a structural domain referenced by a tag element is defined under other title content in this document, the tag element is replaced by multiple tags and sub-tag elements defined in the corresponding tag structure in the other structural domain.

[0035] In a preferred embodiment, extracting and obtaining the element structure set according to the loaded nodes includes:

[0036] A plurality of message type structures are parsed out from a message format standard, and the message structure corresponding to each message type is stored through a class instance.

[0037] In a preferred embodiment, extracting and obtaining the element structure set according to the loaded nodes includes:

[0038] When reading the message format standard, the data structure element set is built into a tree structure according to the label elements marked in the table and the hierarchical relationship of the label in the message structure;

[0039] The class object defines the identification parent node information of the member variable type, defines the identification child node set of the member variable type, and defines the data elements and parsing identifiers corresponding to other member variables.

[0040] In a preferred embodiment, the step of storing the message according to the extracted element structure set includes:

[0041] Get a single object and parse a single message structure tree through member variables; the object is the root node of the tree structure, and each node is an object instance;

[0042] The tree is deeply traversed through the root node. The judgment and loop in the tree depth traversal algorithm integrate business logic, and the tree structure is divided into 1 to N subtrees during traversal. When traversing the tree, when encountering the root node of a subtree, the subtree is not traversed further, and the subtree is traversed deeply separately.

[0043] Perform a deep traversal of the root node objects of a tree or subtree, determine the storage order, and store them in the defined object VO class instance;

[0044] According to business requirements, the VO class definition is mapped into header, body, details and additional domain message blocks. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through deep traversal;

[0045] Convert to a VO class instance, set the sequence number and set the parent node number. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node; when each element is stored in the corresponding data table, it contains the node number and the father node number; if it is associated with the message structure elements in other tables, it contains the corresponding associated node number.

[0046] In a second aspect, the present invention provides a message storage device based on structured documents, comprising:

[0047] Message reading module, reading the message to be stored;

[0048] An extraction module extracts the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure;

[0049] The storage module stores the message according to the extracted element structure set.

[0050] In a preferred embodiment, it also includes:

[0051] A configuration module is used to configure the preset template file.

[0052] In a preferred embodiment, the configuration module includes:

[0053] An element structure configuration unit, configured with an element structure and a tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is a node of the preset template file;

[0054] The node attribute configuration unit configures the attributes of each node and table according to actual business needs.

[0055] In a preferred embodiment, the element structure is a hierarchical structure, and each level is a node of the tree structure;

[0056] The extraction module comprises:

[0057] A preset template file loading unit, which loads the preset template file and traverses all nodes therein;

[0058] A node loading unit, which loads each node according to the type of each node in a loading method corresponding to each node type;

[0059] The element structure set extraction unit extracts the element structure set according to the loaded nodes.

[0060] In a preferred embodiment, the nodes include: a title node, a text node, a table node, and a picture node.

[0061] In a preferred embodiment, if the type of the node is a title node, the node loading unit is specifically used to locate the specific document position according to the title content in the template node; and determine whether log information needs to be output according to the optional state of the node's attributes.

[0062] In a preferred embodiment, if the type of the node is a text node, the node loading unit is specifically used to read the text content corresponding to the description part in the document; and according to the node definition in the template, the read text content is saved in the corresponding data structure.

[0063] In a preferred embodiment, if the type of the node is a table node, the node loading unit is specifically used to verify whether the table at the corresponding position in the document conforms to the template definition based on the table columns defined in the template; if it does, the table structure is extracted and it is determined whether the column name conforms to the template definition; if it does, the table column data is read according to the template file definition.

[0064] In a preferred embodiment, the element structure set extraction unit includes:

[0065] A reading unit reads the table data content into a defined data structure element, wherein a table row data corresponds to an element data structure, and a table corresponds to an element data structure list;

[0066] A first replacement unit, when a structure domain referenced by a tag element is a table structure defined in another document, reads the table data of another file, and causes the tag element to be replaced by a plurality of tags and sub-tag elements defined in a corresponding tag structure in the other file;

[0067] The second replacement unit, when a structural domain referenced by a tag element is defined under other title contents in this document, causes the tag element to be replaced by a plurality of tags and sub-tag elements defined in the corresponding tag structure in the other structural domain.

[0068] In a preferred embodiment, the element structure set extraction unit is specifically used to parse out multiple message type structures in a message format standard, and the message structure corresponding to each message type is stored through a class instance.

[0069] In a preferred embodiment, the element structure set extraction unit is specifically used to build the data structure element set into a tree structure according to the label elements marked in the table and the hierarchical relationship of the label in the message structure when reading the message format standard;

[0070] The class object defines the identification parent node information of the member variable type, defines the identification child node set of the member variable type, and defines the data elements and parsing identifiers corresponding to other member variables.

[0071] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the structured document-based message warehousing method when executing the program.

[0072] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the structured document-based message warehousing method.

[0073] It can be seen from the above technical scheme that the present application provides a method and device for storing messages based on structured documents, the method comprising: reading the message to be stored; extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file, and obtaining an element structure set; the preset template file is a tree structure; and storing the message according to the extracted element structure set. First, compared with the traditional manual entry of message type structure, the present invention saves a lot of manual work and reduces the workflow, and improves the efficiency of the early storage preparation of message maintenance. Secondly, compared with the direct extraction of documents into arrays and linked lists, the tree structure is easier to cut and graft, and solves the problem of assembling the same message type message body structure according to a message type carrier when X (= dozens to hundreds) message types are added or updated, but combining different details, additional fields to verify one or more details, different business types and business categories, and other business scenario verification. In particular, when dozens of message structures correspond to the same business category but different business types, the message body structure of the same business category is extracted, or the unit structure that can be repeated and circulated is marked, etc., which improves the user's customization of the message structure when assembling and sending the message, and improves the efficiency and flexibility of the message in the business verification stage. The present invention quickly and accurately extracts the message structure data into the database, and connects to the message structure proofreading, maintenance, assembly, sending, receiving and other applications. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0075] Figure 1 It is a schematic diagram of the process of storing messages in the prior art in the embodiment of the present application.

[0076] Figure 2 This is a screenshot of the MsgElement class and some member variable definitions in the embodiment of the present application.

[0077] Figure 3 This is a screenshot of the TreeElement class and some member variable definitions in the embodiment of this application.

[0078] Figure 4 This is an example diagram of a message storage method provided in the application example of this application.

[0079] Figure 5 This is an example schematic diagram of a message storage device provided in an application example of the present application.

[0080] Figure 6It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0082] Figure 4 A method for storing messages based on structured documents provided by an embodiment of the present invention is shown. Figure 1 As shown, including:

[0083] S1: Read the message to be stored;

[0084] S2: extracting the table content of each element structure of the message to be stored corresponding to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure;

[0085] S3: Storing the message according to the extracted element structure set.

[0086] The present application provides a method and device for storing messages based on structured documents, the method comprising: reading messages to be stored; extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure; and storing messages according to the extracted element structure set. First, compared with the traditional manual entry of message type structure, the present invention saves a lot of manual work and reduces the workflow, and improves the efficiency of the early storage preparation of message maintenance. Secondly, compared with the direct extraction of documents into arrays and linked lists, the tree structure is easier to cut and graft, which solves the problem of assembling the same message type message body structure according to a message type carrier when X (= dozens to hundreds) message types are added or updated, but combining different details, additional fields to verify one or more details, different business types and business categories, and other business scenario verification. In particular, when dozens of message structures correspond to the same business category but different business types, the message body structure of the same business category is extracted, or the unit structure that can be repeated and circulated is marked, etc., which improves the user's customization of the message structure when assembling and sending the message, and improves the efficiency and flexibility of the message in the business verification stage. The present invention quickly and accurately extracts the message structure data into the database, and connects to the message structure proofreading, maintenance, assembly, sending, receiving and other applications.

[0087] In some embodiments, the present invention further includes: configuring the preset template file.

[0088] The step of configuring the preset template file includes:

[0089] Configuring the element structure and tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is one of the nodes of the preset template file;

[0090] Configure the properties of each node and table according to actual business needs.

[0091] Specifically, define a configurable template file. Before reading a Word document, you need to define a configuration file corresponding to the Word template to define the structure of the document and the content to be extracted. The content that needs to be defined in the template file is:

[0092] (1) Customize the structure of the document and the tree structure content of the file to achieve a configurable hierarchical structure of the definition document, with each level as a node in the configuration file. Node types include: title, text, table, etc.

[0093] (2) Configure node attributes. According to the actual business needs of each node, configure the attributes of the title node, including title name, title number, whether it is a cyclic title, and keywords;

[0094] (3) Configure table properties, such as the width (number of columns) of a table corresponding to a message structure or a message block structure, flexible table width, primary keywords of table column fields, and define the relationship between which field of the database table the read column data should be stored in.

[0095] Furthermore, in some embodiments, the element structure is a hierarchical structure, and each level is a node of the tree structure;

[0096] The step of extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file includes:

[0097] Load the preset template file and traverse all nodes therein;

[0098] Load each node according to the type of each node in a loading method corresponding to each node type;

[0099] The element structure set is obtained according to the loaded node extraction.

[0100] In some embodiments, loading each node according to the type of each node in a loading manner corresponding to each node type includes:

[0101] If the node type is a title node, locate the specific document location according to the title content in the template node;

[0102] Whether log information needs to be output is determined according to the optional state of the attribute of the node.

[0103] In some embodiments, loading each node according to the type of each node in a loading manner corresponding to each node type includes:

[0104] If the node type is a text node, read the text content corresponding to the description part in the document;

[0105] According to the node definition in the template, the read text content is saved in the corresponding data structure.

[0106] In some embodiments, loading each node according to the type of each node in a loading manner corresponding to each node type includes:

[0107] If the type of the node is a table node, verify whether the table at the corresponding position in the document complies with the template definition according to the table columns defined in the template;

[0108] If it does, extract the table structure and determine whether the column name complies with the template definition;

[0109] If it matches, the table column data is read according to the template file definition.

[0110] Specifically, the implementation process includes the following steps:

[0111] (1) Load the template file and traverse all nodes in it, including titles, texts, tables, and pictures. The document structure is a hierarchical structure, and the traversal process needs to be based on the hierarchy;

[0112] (2) Load differently according to the current node type:

[0113] (2.1) Title node: locate the specific document location according to the title content in the template node. If the location cannot be found, it means that the title in the template is not in the document. At the same time, the node attribute "whether it is optional" is used to determine whether the log information needs to be output;

[0114] (2.2) Text node: read the text content corresponding to the description part in the Word document, and save the read data to the corresponding data structure according to the node definition in the template for later use. During the storage step, enter the relevant description as needed;

[0115] (2.3) Table node: Verify based on the table columns defined in the template whether the table at the corresponding position in the document conforms to the template definition, such as 8 columns or 10 columns. If so, extract the table structure; verify whether the column name conforms to the template definition. If so, read the table column data according to the template file definition.

[0116] Furthermore, in some embodiments, Figure 2 and Figure 3 , the element structure set is obtained by extracting the loaded nodes, including:

[0117] Read the table data content into the defined data structure element, where a table row data corresponds to a [StructElement] element data structure, and a table corresponds to a [List <structelement>]'s element data structure list;

[0118] When a tag element such as <groupheader>Referencing a definition in another document <groupheader>When reading another file, the structure field is <groupheader>is replaced by the corresponding tag in the other file <groupheader>Multiple tag elements defined in the structure;

[0119] When an element such as <groupheader>Reference other domains in this document to make the tag <groupheader>Replaced by the corresponding tags in the other domains <groupheader>The structure defines multiple tag elements.

[0120] The message structure is defined by a table and explanatory text. When extracting the table object of the message structure, three data structures are involved. The implementation process is as follows:

[0121] (1) Read the table data content into the defined data structure element. A table row corresponds to an element data structure of [StructElement]. Therefore, a table corresponds to a [List <structelement>] element data structure list. Among them,

[0122] (1.1) When a tag element A refers to a structure field defined in another file: another file B needs to be read, referenced to the configuration, the header and / or table of the corresponding message structure field is found, and the structure field is read in, that is, tag A is replaced by multiple tag elements corresponding to the structure definition of tag A in file B (1:N mapping relationship);

[0123] (1.2) When an element refers to other structural fields in this document, such as the specific business category and business type structural field definitions, the same as above (1.1).

[0124] (2) Multiple message type structures are parsed from the message format standard, and the message structure corresponding to each message type is stored through a [MsgElement] class instance. Then, the [MsgElement] member variable object instance is used as the Value and the message type is used as the Key to store it in a Map object. <String,List <structelement>>.

[0125] The MsgElement class defines and stores the message type, message structure object set, and message structure structure object parsed from the message format standard.

[0126] (3) When reading the message structure of a specific message type in the message format standard file, according to the label elements marked in the table and the hierarchical relationship of the label in the message structure, the data structure element set [List <structelement>] builds a tree structure and stores it in the member variable tree in [MsgElement]. Tree is an object of the [TreeElement] class and stores the root node information of the tree.

[0127] Among them, the class TreeElement defines a member variable parent of type [TreeElement] to identify the parent node information; defines a member variable List <treeelement>The child type identifies the child node collection; defines other member variables corresponding to the corresponding data elements in [StructElement] and the parsing identifier.

[0128] The root node of the message tree is unified as a label <document>The information is stored through a [TreeElement] class instance, and the branch corresponding label elements are stored in [TreeElement], which are connected through the member variables parent and child storage addresses.

[0129] Furthermore, the extracting and obtaining the element structure set according to the loaded nodes includes:

[0130] Multiple message type structures are parsed out in the message format standard. The message structure corresponding to each message type is stored through a [MsgElement] class instance, where the [MsgElement] member variable object instance is used as the Value and the message type is used as the Key, which are stored together in a Map object. <String,List <structelement>>.

[0131] Furthermore, the element structure set is obtained by extracting the loaded nodes, including:

[0132] When reading the message format standard, according to the label elements marked in the table and the hierarchical relationship of the label in the message structure, the data structure element set [List <structelement>]Build a tree structure and store it in the member variable tree in [MsgElement]. Tree is a [TreeElement] class object that stores the tree root node information;

[0133] Among them, the class TreeElement defines a member variable parent of type [TreeElement] to identify the parent node information; defines a member variable List <treeelement>The child type identifies the child node collection; defines other member variables corresponding to the corresponding data elements in [StructElement] and the parsing identifier.

[0134] In other embodiments, storing the message according to the extracted element structure set includes:

[0135] Get a single MsgElement object and parse a single message structure tree through the member variable tree. The object tree is the root node of the tree structure, and each node is a [TreeElement] object instance.

[0136] The tree is deeply traversed through the root node tree. In the tree depth traversal algorithm, judgment and looping are integrated with business logic, and the tree structure is split into 1 to N subtrees during traversal. When traversing the tree, when encountering the root node of a subtree, the subtree is not traversed further, and the subtree is traversed deeply separately.

[0137] Perform a tree depth traversal on the root node [TreeElement] object of the tree or subtree, determine the storage order, and store it in the defined object VO class instance;

[0138] According to business requirements, VO class definitions are mapped into message blocks such as header, message body, details and additional fields. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through deep traversal;

[0139] Convert to a VO class instance, set the sequence number and set the parent node number. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node; that is, when each element is stored in the corresponding data table, it contains the node number and the parent node number; if it is associated with the message structure elements in other tables, it contains the corresponding associated node number.

[0140] Specifically, the element structure set extracted in the third step is stored in the database. This system takes into account the message type, business type and message assembly requirements of the business type, and the storage is implemented as follows:

[0141] (1) Get a single MsgElement object and parse a single message structure tree through the member variable tree. The object tree is the root node of the tree structure, and each node is a [TreeElement] object instance. The tree is deeply traversed through the root node tree.

[0142] Among them, the tree depth traversal algorithm judges and loops the integration of business logic (for example, analyzing the assembly of multiple detailed information of business messages, considering the structural requirements of the same message body but different business types and business categories), and splits the tree structure into 1 to N subtrees during traversal. When traversing the tree, when encountering the root node of the subtree, the subtree is not traversed further, and the subtree is traversed in depth separately.

[0143] When performing a tree depth traversal on the root node [TreeElement] object of a tree or subtree, determine the storage order and store it in the defined object VO class instance.

[0144] (2) According to business requirements, the VO class definition is mapped into message blocks such as header, body, details and additional fields. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through deep traversal.

[0145] When converted to a VO class instance, the sequence number and the parent node number are set. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node. In other words, when each element is stored in the corresponding data table, it contains the node number and the parent node number. If it is associated with a message structure element in another table, it contains the corresponding node number.

[0146] It can be understood that, firstly, compared with the traditional manual entry of message type structure, the present invention saves a lot of manual work and shortens the workflow, thereby improving the efficiency of the early storage preparation of message maintenance.

[0147] Secondly, compared with directly extracting documents into arrays and linked lists, tree structures are easier to cut and graft, and solve the business scenario verification when X (= dozens to hundreds) message types are added or updated. According to a message type carrier, they are assembled into the same message type message body structure but with different details, additional fields to verify one or more details, different business types and business categories. In particular, when dozens of message structures correspond to the same business category but different business types, the same business category message body structure is extracted, or a unit structure that can be repeated and circulated is marked, etc., which improves the user's customization of the assembled message structure when the message is assembled and sent, and improves the efficiency and flexibility of the message in the business verification stage.

[0148] From the software level, the present application provides an embodiment of a message storage device based on a structured document for executing all or part of the content of the message storage method based on a structured document, see Figure 5 The message storage device based on structured documents specifically includes the following contents:

[0149] Message reading module 1, reading the message to be stored;

[0150] Extraction module 2, extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file, to obtain an element structure set; the preset template file is a tree structure;

[0151] The storage module 3 stores the message according to the extracted element structure set.

[0152] In a preferred embodiment, it also includes:

[0153] Configuration module 4, configures the preset template file.

[0154] In a preferred embodiment, the configuration module includes:

[0155] An element structure configuration unit, configured with an element structure and a tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is a node of the preset template file;

[0156] The node attribute configuration unit configures the attributes of each node and table according to actual business needs.

[0157] In a preferred embodiment, the element structure is a hierarchical structure, and each level is a node of the tree structure;

[0158] The extraction module comprises:

[0159] A preset template file loading unit, which loads the preset template file and traverses all nodes therein;

[0160] A node loading unit, which loads each node according to the type of each node in a loading method corresponding to each node type;

[0161] The element structure set extraction unit extracts the element structure set according to the loaded nodes.

[0162] In a preferred embodiment, the nodes include: a title node, a text node, a table node, and a picture node.

[0163] In a preferred embodiment, if the type of the node is a title node, the node loading unit is specifically used to locate the specific document position according to the title content in the template node; and determine whether log information needs to be output according to the optional state of the node's attributes.

[0164] In a preferred embodiment, if the type of the node is a text node, the node loading unit is specifically used to read the text content corresponding to the description part in the document; and according to the node definition in the template, the read text content is saved in the corresponding data structure.

[0165] In a preferred embodiment, if the type of the node is a table node, the node loading unit is specifically used to verify whether the table at the corresponding position in the document conforms to the template definition based on the table columns defined in the template; if it does, the table structure is extracted and it is determined whether the column name conforms to the template definition; if it does, the table column data is read according to the template file definition.

[0166] In a preferred embodiment, the element structure set extraction unit includes:

[0167] Read the table data content into the defined data structure element, where a table row data corresponds to a [StructElement] element data structure, and a table corresponds to a [List <structelement>]'s element data structure list;

[0168] A first replacement unit, when a tag element A refers to a structural domain defining A in another document, reads another file and causes the tag A to be replaced with a plurality of tag elements corresponding to the structural definition of the tag A in the another file;

[0169] The second replacement unit, when a certain element references other structural domains in this document, causes the tag M to be replaced by a plurality of tag elements of the structural definition corresponding to the tag M in the other structural domains.

[0170] In a preferred embodiment, the element structure set extraction unit is specifically used to parse out multiple message type structures in the message format standard, and the message structure corresponding to each message type is stored through a [MsgElement] class instance, wherein the [MsgElement] member object instance is used as a Value and the message type is used as a Key, and is stored together in a Map object, and the Map <String,List <structelement>>.

[0171] In a preferred embodiment, the element structure set extraction unit is specifically used to extract the data structure element set [List] according to the label element marked in the table and the hierarchical relationship of the label in the message structure when reading the message format standard. <structelement>]A tree structure is built and stored in the member variable tree in [MsgElement]. Tree is a [TreeElement] class object that stores the tree root node information;

[0172] Among them, the class TreeElement defines a member variable of type [TreeElement] parent to identify the parent node information; defines a member variable List <treeelement>The child type identifies the child node collection; defines other member variables corresponding to the corresponding data elements in [StructElement] and the parsing identifier.

[0173] In a preferred embodiment, the warehousing module includes:

[0174] The object acquisition unit acquires a single MsgElement object and parses a single message structure tree through the member variable tree; wherein the object tree is the root node of the tree structure, and each node is a [TreeElement] object instance;

[0175] The node depth traversal unit performs a deep traversal of the tree through the tree root node tree. The judgment and loop in the tree depth traversal algorithm integrate business logic, and the tree structure is split into 1 to N subtrees during traversal. When traversing the tree, when encountering the subtree root node, the subtree is not traversed further, and the subtree is traversed separately.

[0176] The object depth traversal unit performs a tree depth traversal on the root node [TreeElement] object of the tree or subtree, determines the storage order, and stores it in the defined object VO class instance;

[0177] VO class instance list organization unit. According to business requirements, VO class definition is mapped into header, body, details and additional domain message blocks. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through depth traversal.

[0178] The conversion unit converts into a VO class instance, sets the sequence number and sets the parent node number. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node; that is, when each element is stored in the corresponding data table, it contains the node number and the father node number; if it is associated with the message structure element in other tables, it contains the corresponding associated node number.

[0179] The present application provides a message storage device based on structured documents, and its corresponding method includes: reading the message to be stored; extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure; and storing the message according to the extracted element structure set. First, compared with the traditional manual entry of message type structure, the present invention saves a lot of manual work and reduces the workflow, and improves the efficiency of the early storage preparation of message maintenance. Secondly, compared with the direct extraction of documents into arrays and linked lists, the tree structure is easier to cut and graft, which solves the problem of assembling the same message type message body structure according to a message type carrier when X (= dozens to hundreds) message types are added or updated, but combining different details, additional fields to verify one or more details, different business types and business categories, and other business scenario verification. In particular, when dozens of message structures correspond to the same business category but different business types, the message body structure of the same business category is extracted, or the unit structure that can be repeated and circulated is marked, etc., which improves the user's customization of the message structure when assembling and sending the message, and improves the efficiency and flexibility of the message in the business verification stage. The present invention quickly and accurately extracts the message structure data into the database, and connects to the message structure proofreading, maintenance, assembly, sending, receiving and other applications.

[0180] In another embodiment, the message entry device based on structured documents can be configured separately from the central processing unit 9100. For example, the message entry device based on structured documents can be configured as a chip connected to the central processing unit 9100, and the message entry function based on structured documents can be realized through the control of the central processing unit.

[0181] like Figure 6 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Figure 6 In addition, the electronic device 9600 may also include Figure 6 For components not shown, reference may be made to the prior art.

[0182] like Figure 6 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0183] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0184] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0185] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

[0186] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0187] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0188] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0189] The embodiment of the present application also provides a computer-readable storage medium capable of implementing all the steps in the message storage method based on structured documents in the above embodiment. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps in the message storage method based on structured documents in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0190] S1: Read the message to be stored;

[0191] S2: extracting the table content of each element structure of the message to be stored corresponding to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure;

[0192] S3: Storing the message according to the extracted element structure set.

[0193] It is understandable that the preset business object model, business object model and target business object model mentioned in this application all refer to the visual data hierarchical logical model of the same type and content requirements. The preset business object model refers to the business object model that has been stored locally, and the target business object model refers to the business object model that is currently in the generation state and corresponds to the target financial business. First, compared with the traditional manual entry of message type structure, it saves a lot of manual work and reduces the workflow, and improves the efficiency of the early storage preparation of message maintenance. Secondly, compared with the direct extraction of documents into arrays and linked lists, the tree structure is easier to cut and graft, and solves the problem of assembling the same message type message body structure according to a message type carrier but combining different details, additional fields to verify one or more details, different business types and business categories, and other business scenario verification. In particular, when dozens of message structures correspond to the same business category but different business types, the message body structure of the same business category is extracted, or the unit structure that can be repeated and circulated is marked, etc., which improves the user's customization of the message structure when assembling and sending the message, and improves the efficiency and flexibility of the message in the business verification stage. The present invention quickly and accurately extracts the message structure data into the database, and connects to the message structure proofreading, maintenance, assembly, sending, receiving and other applications.

[0194] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0195] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0196] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0198] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.< / treeelement> < / structelement> < / structelement> < / structelement> < / treeelement> < / structelement> < / structelement> < / document> < / treeelement> < / structelement> < / structelement> < / structelement> < / groupheader> < / groupheader> < / groupheader> < / groupheader> < / groupheader> < / groupheader> < / groupheader> < / structelement>

Claims

1. A message storage method based on structured documents. It is characterized in that include: Read the message to be stored; Extract the table content of each element structure corresponding to the message to be stored according to the element structure of a preset template file to obtain an element structure set; The preset template file is a tree structure; Storing messages according to the extracted element structure set; Wherein, the element structure is a hierarchical structure, and each level is a node of the tree structure; The step of extracting the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file includes: Load the preset template file and traverse all nodes therein; Load each node according to the type of each node in a loading method corresponding to each node type; Extracting and obtaining the element structure set according to the loaded nodes; The step of extracting the element structure set according to the loaded nodes includes: When reading the message format standard, the data structure element set is built into a tree structure according to the label elements marked in the table and the hierarchical relationship of the label in the message structure; The class object defines the identification parent node information of the member variable type, defines the identification child node set of the member variable type, and defines the data elements and parsing identifiers corresponding to other member variables; Read the table data content into the defined data structure element, where a table row data corresponds to an element data structure of a structure element, and a table corresponds to an element data structure list of a data structure element set; When a tag element refers to a structural domain defining a tag element in another document, another file is read and the tag element is replaced with a plurality of tag elements of the structural definition of the corresponding tag element in the another file; When a tag element references other structural domains in this document, the tag element is replaced by multiple tag elements of the structure definition of the corresponding tag element in the other structural domains.

2. The message storage method based on structured documents according to claim 1, It is characterized in that Also includes: Configure the preset template file.

3. The message storage method based on structured documents according to claim 2, It is characterized in that Configuring the preset template file includes: Configuring the element structure and tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is one of the nodes of the preset template file; Configure the properties of each node and table according to actual business needs.

4. The message storage method based on structured documents according to claim 1 or 3, It is characterized in that The nodes include: title nodes, text nodes, table nodes and picture nodes.

5. The method for storing messages based on structured documents according to claim 1, It is characterized in that The step of loading each node in a loading manner corresponding to each node type according to the type of each node includes: If the node type is a title node, locate the specific document location according to the title content in the template node; Whether log information needs to be output is determined according to the optional state of the attribute of the node.

6. The method for storing messages based on structured documents according to claim 1, It is characterized in that The step of loading each node in a loading manner corresponding to each node type according to the type of each node includes: If the node type is a text node, read the text content corresponding to the description part in the document; According to the node definition in the template, the read text content is saved in the corresponding data structure.

7. The method for storing messages based on structured documents according to claim 1, It is characterized in that The step of loading each node in a loading manner corresponding to each node type according to the type of each node includes: If the type of the node is a table node, verify whether the table at the corresponding position in the document complies with the template definition according to the table columns defined in the template; If it does, extract the table structure and determine whether the column name complies with the table template definition; If it matches, the table column data is read according to the template file definition.

8. The method for storing messages based on structured documents according to claim 1, It is characterized in that The step of extracting the element structure set according to the loaded nodes includes: Read the table data content into the defined data structure elements, where a table row data corresponds to an element data structure, and a table corresponds to an element data structure list; When a structure domain referenced by a tag element is a table structure defined in another document, the table data of another file is read so that the tag element is replaced by a plurality of tags and sub-tag elements defined in the corresponding tag structure in the other file; When a structural domain referenced by a tag element is defined under other title content in this document, the tag element is replaced by multiple tags and sub-tag elements defined in the corresponding tag structure in the other structural domain.

9. The method for storing messages based on structured documents according to claim 1, It is characterized in that The step of extracting the element structure set according to the loaded nodes includes: A plurality of message type structures are parsed out from a message format standard, and the message structure corresponding to each message type is stored through a class instance.

10. The method for storing messages based on structured documents according to claim 1, It is characterized in that The storing of messages according to the extracted element structure set includes: Get a single object and parse a single message structure tree through member variables; the object is the root node of the tree structure, and each node is an object instance; The tree is deeply traversed through the root node. The judgment and loop in the tree depth traversal algorithm integrate business logic, and the tree structure is divided into 1 to N subtrees during traversal. When traversing the tree, when encountering the root node of a subtree, the subtree is not traversed further, and the subtree is traversed deeply separately. Perform a deep traversal of the root node objects of a tree or subtree, determine the storage order, and store them in the defined object VO class instance; According to business requirements, the VO class definition is mapped into header, body, details and additional domain message blocks. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through deep traversal; Convert to a VO class instance, set the sequence number and set the parent node number. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node; when each element is stored in the corresponding data table, it contains the node number and the father node number; if it is associated with the message structure elements in other tables, it contains the corresponding associated node number.

11. A message storage device based on structured documents, It is characterized in that include: Message reading module, reading messages to be stored; An extraction module extracts the table content corresponding to each element structure of the message to be stored according to the element structure of a preset template file to obtain an element structure set; the preset template file is a tree structure; The storage module stores the message according to the extracted element structure set; The element structure is a hierarchical structure, and each level is a node of the tree structure; the extraction module includes: A preset template file loading unit, which loads the preset template file and traverses all nodes therein; A node loading unit, which loads each node according to the type of each node in a loading method corresponding to each node type; An element structure set extraction unit, extracting the element structure set according to the loaded nodes; The element structure set extraction unit is specifically used to build the data structure element set into a tree structure according to the label elements marked in the table and the hierarchical relationship of the label in the message structure when reading the message format standard; Among them, the class object defines the identification parent node information of the member variable type, and defines the identification child node set of the member variable type, and defines the data elements and parsing identifiers corresponding to other member variables; reads the table data content into the defined data structure element, wherein a table row data corresponds to an element data structure of a structure element, and a table corresponds to an element data structure list of a data structure element set; when a tag element references a structure domain defining a tag element in another document, reads another file, and causes the tag element to be replaced by multiple tag elements of the structure definition of the corresponding tag element in the other file; when a tag element references other structure domains in this document, causes the tag element to be replaced by multiple tag elements of the structure definition of the corresponding tag element in the other structure domains.

12. The message storage device based on structured documents according to claim 11, It is characterized in that Also includes: A configuration module is used to configure the preset template file.

13. The message storage device based on structured documents according to claim 12, It is characterized in that The configuration module includes: An element structure configuration unit, configured with an element structure and a tree structure content of the preset template file; wherein the element structure is a hierarchical structure, and each level is a node of the preset template file; The node attribute configuration unit configures the attributes of each node and table according to actual business needs.

14. The message storage device based on structured documents according to claim 11 or 13, It is characterized in that The nodes include: title nodes, text nodes, table nodes and picture nodes.

15. The message storage device based on structured documents according to claim 11, It is characterized in that If the type of the node is a title node, the node loading unit is specifically used to locate a specific document position according to the title content in the template node; and determine whether log information needs to be output according to the optional state of the attribute of the node.

16. The message storage device based on structured documents according to claim 11, It is characterized in that If the type of the node is a text node, the node loading unit is specifically used to read the text content corresponding to the description part in the document; and according to the node definition in the template, save the read text content into the corresponding data structure.

17. The message storage device based on structured documents according to claim 11, It is characterized in that If the type of the node is a table node, the node loading unit is specifically used to verify whether the table at the corresponding position in the document conforms to the template definition based on the table columns defined in the template; if it does, the table structure is extracted and it is determined whether the column name conforms to the template definition; if it does, the table column data is read according to the template file definition.

18. The message storage device based on structured documents according to claim 11, It is characterized in that The element structure set extraction unit comprises: A reading unit reads the table data content into a defined data structure element, wherein a table row data corresponds to an element data structure, and a table corresponds to an element data structure list; A first replacement unit, when a structure field referenced by a tag element is a table structure defined in another document, reads the table data of another file, and causes the tag element to be replaced by a plurality of tags and sub-tag elements defined in a corresponding tag structure in the other file; The second replacement unit, when a structural domain referenced by a tag element is defined under other title contents in this document, causes the tag element to be replaced by a plurality of tags and sub-tag elements defined in the corresponding tag structure in the other structural domain.

19. The message storage device based on structured documents according to claim 11, It is characterized in that The element structure set extraction unit is specifically used to parse out multiple message type structures in a message format standard, and the message structure corresponding to each message type is stored through a class instance.

20. The message storage device based on structured documents according to claim 11, It is characterized in that The storage module comprises: The object acquisition unit acquires a single object and parses a single message structure tree through member variables; wherein the object is the root node of the tree structure and each node is an object instance; The node depth traversal unit performs a deep traversal of the tree through the root node. The judgment and loop in the tree depth traversal algorithm integrate business logic, and the tree structure is split into 1 to N subtrees during traversal. When traversing the tree, when encountering the root node of a subtree, the subtree is not traversed further, and the subtree is traversed deeply separately. The object depth traversal unit performs a tree depth traversal on the root node objects of the tree or subtree, determines the storage order, and stores them in the defined object VO class instance; The VO class instance list organization unit maps the VO class definition into header, body, details and additional domain message blocks according to business requirements. Each message block is a separate tree or subtree, which is organized into the corresponding VO class instance list through depth traversal; The conversion unit sets the sequence number and the parent node number. At the same time, the VO class instance corresponding to the subtree node stores the node number associated with the main tree node; when each element is stored in the corresponding data table, it contains the node number and the parent node number; if it is associated with the message structure element in other tables, it contains the corresponding associated node number.

21. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the structured document-based message warehousing method described in any one of claims 1 to 10 is implemented.

22. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the structured document-based message storage method described in any one of claims 1 to 10 is implemented.