Message conversion code generation method, related device and computer storage medium

By automatically generating message conversion code, the complexity of XML message conversion in NDC protocol version updates is solved, improving development efficiency and accuracy. It also provides an intuitive requirement analysis tool that supports requirement adjustments and secondary development.

CN115392193BActive Publication Date: 2026-04-14TRAVELSKY TECHNOLOGY LIMITED
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TRAVELSKY TECHNOLOGY LIMITED
Filing Date
2022-08-23
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

During the NDC protocol version update process, the Aggregator needs to manually record and convert different versions of XML messages, which makes the understanding and implementation process complex, prone to errors, and increases testing and communication costs.

Method used

This paper provides a method for generating message conversion code. By reading and parsing an XML schema definition file, it generates a Hypertext Markup Language tree, receives the mapping relationship edited by the user, and automatically generates message conversion code to assist development and show the differences in requirements.

Benefits of technology

It simplifies the conversion process between NDC interface versions, improves development efficiency, reduces errors, provides intuitive requirements analysis tools, and supports requirements adjustment and secondary development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115392193B_ABST
    Figure CN115392193B_ABST
Patent Text Reader

Abstract

The application provides a message conversion code generation method, related device and computer storage medium, the method comprises the following steps: respectively analyzing an XML schema definition source file and a target XML schema definition file to obtain an XML schema definition source file object tree and a target XML schema definition file object tree; generating a first hypertext markup language tree according to the XML schema definition source file object tree in a preset format; generating a second hypertext markup language tree according to the target XML schema definition file object tree in a preset format; showing the first hypertext markup language tree and the second hypertext markup language tree to a user; receiving a mapping relationship group of nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; and generating a message conversion code according to the mapping relationship group of the nodes in the first hypertext markup language tree and the nodes in the second hypertext markup language tree. Thus, the development work is assisted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method for generating message conversion codes, related apparatus, and computer storage medium. Background Technology

[0002] Since the International Air Transport Association (IATA) introduced New Distribution Capability (NDC) in 2012, it has received close attention from the industry. With the development of the internet, more and more airlines in various countries have begun to support the NDC agreement, and new distribution systems based on the NDC agreement have gradually been implemented. "NDC capability" has become an important indicator for airline partners.

[0003] Currently, IATA's NDC strategy involves partnering with Global Distribution Systems (GDS) to make GDSs act as Aggregators within the NDC architecture. When a client requests flight information from a GDS, the Aggregator must initiate corresponding offer requests (offers from airlines, which can include a package of services such as tickets and additional services) to other content providers (airlines or other GDSs). Based on the information provided by the client, the Aggregator performs real-time searches and inquiries, and can also choose to package hotel, ground transportation, and destination activities booking services. It then aggregates offer information from various airlines and presents it to the end customer for selection. Therefore, the Aggregator will receive XML (Extensible Markup Language, a subset of Standard Generalized Markup Language, a markup language used to structure electronic documents; XML is designed for data transmission and storage) messages from the NDC and parse and process the returned messages to complete the aggregation function.

[0004] However, the NDC protocol is constantly evolving, with its version updated annually. Different IT vendors may use different versions when implementing the NDC protocol, which poses challenges for the Aggregator. The Aggregator needs to adapt and convert different versions of NDC messages for each business interface of the NDC protocol to a unified NDC version for the requesting client. The traditional method of recording version differences and conversion rules is through text descriptions, which are then understood and confirmed by developers before being implemented in code. However, given the large number of XML nodes, complex hierarchical relationships, and logical conversion relationships in the NDC protocol, this approach is difficult to read and understand, and is prone to errors and loss of node correspondences, which also increases testing and communication costs. Summary of the Invention

[0005] In view of this, this application provides a method, related device, and computer storage medium for generating message conversion codes, thereby automatically generating conversion codes to assist in development work. It can also serve as a requirement design tool for NDC interface version conversion and a template for requirement analysis and discussion during the requirement confirmation phase before development. Its tree-view XSD structure and visual double-tree node connection function intuitively and accurately demonstrate the requirement differences between two versions of the same interface. Its connection saving function also facilitates requirement adjustments, secondary development, and other application scenarios, providing technical support for airline IT suppliers developing Aggregators.

[0006] The first aspect of this application provides a method for generating message conversion codes, including:

[0007] Read the XML schema definition source file and the target XML schema definition file; wherein the content of the XML schema definition source file and the target XML schema definition file is text information;

[0008] The XML schema definition source file and the target XML schema definition file are parsed separately to obtain the XML schema definition source file object tree and the target XML schema definition file object tree. The node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include the following information: node identifier, node name, node type, data type, whether required flag, node path, and collection of child node objects.

[0009] The XML schema definition source file object tree and the target XML schema definition file object tree are converted into a preset format; wherein, the preset format is a data format that can be recognized by front-end technology;

[0010] The source file object tree is defined according to the preset XML schema, and the first hypertext markup language tree is generated.

[0011] Based on the target XML schema definition tree in the preset format, a second hypertext markup language tree is generated;

[0012] Display the first hypertext markup language tree and the second hypertext markup language tree to the user;

[0013] Receive a mapping relationship group between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes;

[0014] Based on the mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree, message conversion code is generated.

[0015] Optionally, the step of parsing the XML schema definition source file and the target XML schema definition file respectively to obtain the XML schema definition source file object tree and the target XML schema definition file object tree includes:

[0016] Based on the XML code in the XML schema definition source file, and following the syntax rules of the XML schema definition file, an object tree of the XML schema definition source file is constructed using an object-oriented programming language.

[0017] Based on the XML code in the target XML schema definition file, and following the syntax rules of the XML schema definition file, an object tree of the target XML schema definition file is constructed using an object-oriented programming language.

[0018] Optionally, the method for generating the message conversion code further includes:

[0019] The mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree is saved and persisted.

[0020] Optionally, the method for generating the message conversion code further includes:

[0021] Receive a user's query request; wherein the query request includes target information;

[0022] The target information is queried in the saved node mapping relationship group to obtain the query results and display them to the user.

[0023] Optionally, the method for generating the message conversion code further includes:

[0024] Receive an editing request from a user; wherein the editing request includes information to be edited;

[0025] The node mapping relationship is edited according to the information to be edited and then displayed to the user.

[0026] A second aspect of this application provides an apparatus for generating message conversion codes, comprising:

[0027] The reading unit is used to read the XML schema definition source file and the target XML schema definition file; wherein the content of the XML schema definition source file and the target XML schema definition file is text information;

[0028] The parsing unit is used to parse the XML schema definition source file and the target XML schema definition file respectively, to obtain the XML schema definition source file object tree and the target XML schema definition file object tree; the node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include the following information: node identifier, node name, node type, data type, whether required flag, node path, and collection of child node objects;

[0029] The conversion unit is used to convert the XML schema definition source file object tree and the target XML schema definition file object tree into a preset format; wherein, the preset format is a data format that can be recognized by the front-end technology;

[0030] The first generation unit is used to define the source file object tree according to the preset format XML pattern and generate the first hypertext markup language tree;

[0031] The second generation unit is used to generate a second hypertext markup language tree based on the target XML schema definition file object tree in a preset format.

[0032] The first display unit is used to display the first hypertext markup language tree and the second hypertext markup language tree to the user;

[0033] The first receiving unit is used to receive a mapping relationship group between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes;

[0034] The third generation unit is used to generate message conversion code based on the mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree.

[0035] Optionally, the parsing unit includes:

[0036] The first parsing subunit is used to construct an XML schema definition source file object tree according to the XML code in the XML schema definition source file and the syntax rules of the XML schema definition file, using an object-oriented programming language.

[0037] The second parsing subunit is used to construct the target XML schema definition file object tree according to the XML code in the target XML schema definition file and the syntax rules of the XML schema definition file, using an object-oriented programming language.

[0038] Optionally, the message conversion code generation device further includes:

[0039] The storage unit is used to store and persist the mapping relationship between the nodes in the first hypertext markup language tree and the nodes in the second hypertext markup language tree.

[0040] Optionally, the message conversion code generation device further includes:

[0041] The second receiving unit is used to receive a user's query request; wherein the query request includes target information;

[0042] The query unit is used to query the target information in the saved node mapping relationship group, obtain the query results, and display them to the user.

[0043] Optionally, the message conversion code generation device further includes:

[0044] The third receiving unit is used to receive the user's editing request; wherein the editing request includes information to be edited;

[0045] The editing unit is used to edit the node mapping relationship group according to the information to be edited, and then display it to the user.

[0046] A third aspect of this application provides an electronic device, comprising:

[0047] One or more processors;

[0048] A storage device on which one or more programs are stored;

[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the message translation code generation method as described in any one of the first aspects.

[0050] The fourth aspect of this application provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the message conversion code generation method as described in any one of the first aspects.

[0051] As can be seen from the above scheme, this application provides a method, related apparatus, and computer storage medium for generating message conversion codes. The method for generating message conversion codes includes: first, reading an XML schema definition source file and a target XML schema definition file; wherein the content of the XML schema definition source file and the target XML schema definition file is text information; then, parsing the XML schema definition source file and the target XML schema definition file respectively to obtain an XML schema definition source file object tree and a target XML schema definition file object tree; wherein the node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include the following information: node identifier, node name, node type, data type, mandatory flag, node path, and a collection of child node objects; then, the XML schema... The process involves: converting the source file object tree and the target XML schema definition file object tree into a preset format; generating a first Hypertext Markup Language (HTML) tree based on the preset format of the source file object tree; generating a second HTML tree based on the target XML schema definition file object tree; displaying the first and second HTML trees to the user; receiving a mapping relationship group between nodes in the first and second HTML trees edited by the user; wherein the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes; and finally, generating message conversion code based on the mapping relationship group between nodes in the first and second HTML trees. This achieves the goal of automatically generating conversion code, thereby assisting development work. It can also serve as a requirement design tool for NDC interface version conversion and a template for requirement analysis and discussion during the requirement confirmation phase before development. Its tree-shaped XSD structure and visual double-tree node connection function intuitively and accurately show the requirement differences between two versions of the same interface. Its connection saving function also facilitates requirement adjustment, secondary development, and other application scenarios, providing technical support for airline IT suppliers when developing Aggregator. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of this application 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 embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0053] Figure 1 A detailed flowchart illustrating a method for generating message conversion codes provided in this application embodiment;

[0054] Figure 2 A detailed flowchart for constructing an object tree is provided in another embodiment of this application;

[0055] Figure 3 A schematic diagram of an XML schema definition source file object tree provided for another embodiment of this application;

[0056] Figure 4 A schematic diagram of a target XML schema definition file object tree provided for another embodiment of this application;

[0057] Figure 5 This is a schematic diagram illustrating how nodes in the HTML tree of a source message and nodes in the HTML tree of a target message are connected by lines, according to another embodiment of this application.

[0058] Figure 6 A schematic diagram of a message conversion code generation apparatus provided in another embodiment of this application;

[0059] Figure 7 This is a schematic diagram of an electronic device that implements a method for generating message conversion codes, as provided in another embodiment of this application. Detailed Implementation

[0060] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0061] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0062] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0063] It should be noted that the terms "a" and "a plurality of" used in this application are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0064] This application provides a method for generating message conversion codes, such as... Figure 1 As shown, the specific steps include:

[0065] S101. Read the XML schema definition source file and the target XML schema definition file.

[0066] The content of the XML schema definition source file and the target XML schema definition file is text information.

[0067] It's important to note that an XML Schema Definition (XSD) file defines a group of legal components for an XML document, describing its structure. It serves the same purpose as a Document Type Definition (DTD) and can replace it. An XSD defines: elements that can appear in the document; attributes that can appear in the document; which elements are child elements; the order of child elements; the number of child elements; whether an element should contain text or be empty; the data types of elements and attributes; and the default and fixed values ​​for elements and attributes.

[0068] Specifically, taking the XML schema definition source file (XSD source file) as an example, select the local XSD source file to obtain the path of the XSD source file, and read the file stream according to the selected XSD source file path to obtain the content of the XSD source file.

[0069] S102. Parse the XML schema definition source file and the target XML schema definition file respectively to obtain the XML schema definition source file object tree and the target XML schema definition file object tree.

[0070] The node objects of both the source and target XML schema definition file object trees include the following information: node identifier, node name, node type, data type, mandatory flag, node path, and collection of child node objects.

[0071] Node ID (id): Identity, representing the unique identifier of the current node in the entire XSD object tree (the XML schema definition source file object tree and the target XML schema definition file object tree mentioned above).

[0072] Node name (label): Represents the English name of the current node.

[0073] Node level: Indicates whether the current node is a root node, a child node, or a leaf node.

[0074] Node type: Indicates whether the current node is an element or an attribute in the structure described by the XML object tree.

[0075] Data type (datatype): Represents the data structure of the current node, including String type, which means that the content of the current node only contains text; Object type, which means that the node contains a collection of child nodes, which is not empty and has a length >= 1; Array type, which means that the structure of the current node is an array; ArrayList type, which means that the structure of the current node is an array, and each element in the array is an object node (Object).

[0076] The "isMust" flag indicates whether the node is required to exist.

[0077] Node path: Represents the names of all nodes traversed from the root node to the current node.

[0078] The collection of child node objects (children) is an array containing all the child node objects of the current node (the child node objects are the subtree of the current node).

[0079] Optionally, in another embodiment of this application, one implementation of step S102 is as follows: Figure 2 As shown, it includes:

[0080] S201. Based on the XML code in the XML schema definition source file, and following the syntax rules of the XML schema definition file, construct the XML schema definition source file object tree using an object-oriented programming language.

[0081] Specifically, in the specific implementation process of this application, it can be done according to Figure 3 The XML structure creates an instance of each node, and further, by assigning values ​​to the member variables of each node, an instance of the entire XML schema definition source file object tree is constructed.

[0082] S202. Based on the XML code in the target XML schema definition file, and following the syntax rules of the XML schema definition file, construct the target XML schema definition file object tree using an object-oriented programming language.

[0083] Specifically, in the specific implementation process of this application, it can be done according to Figure 4 The XML structure creates an instance of each node, and further, by assigning values ​​to the member variables of each node, an instance of the entire target XML schema definition file object tree is constructed.

[0084] S103. Convert the XML schema definition source file object tree and the target XML schema definition file object tree into a preset format.

[0085] The default format is a data format that the front-end technology can recognize. For example, if the front-end technology is JavaScript, then the default format is JSON.

[0086] It is understandable that converting the XML schema definition source file object tree and the target XML schema definition file object tree into a preset format does not change the content in the XML schema definition source file object tree and the target XML schema definition file object tree, and the nodes in the preset format XML schema definition source file object tree correspond one-to-one with the nodes in the XML schema definition source file object tree; the nodes in the preset format target XML schema definition file object tree also correspond one-to-one with the nodes in the target XML schema definition file object tree.

[0087] JavaScript is a high-level scripting language used in web application development. It's commonly used to add various dynamic functionalities to web pages, providing users with a smoother and more visually appealing browsing experience. JavaScript scripts typically implement their functionality by being embedded in HTML.

[0088] HTML stands for Hypertext Markup Language, a markup language. It consists of a series of tags. These tags unify the format of documents on the web, connecting scattered internet resources into a logical whole. It uses markup symbols to mark the various parts of a webpage to be displayed; "hypertext" means that a page can contain non-text elements such as images, links, and even music and programs.

[0089] JSON (JavaScript Object Notation) is a lightweight data-interchange format. Its concise and clear hierarchical structure makes JSON an ideal language for data exchange. It is easy for humans to read and write, as well as easy for machines to parse and generate, effectively improving network transmission efficiency.

[0090] JSON can convert a set of data represented in a JavaScript object into a string, which can then be easily transmitted between networks or programs and restored to a data format supported by various programming languages ​​when needed.

[0091] The specific implementation methods can be, but are not limited to, the following:

[0092]

[0093]

[0094]

[0095]

[0096] S104. Define the source file object tree according to the preset XML pattern and generate the first hypertext markup language tree.

[0097] The first Hypertext Markup Language (HTML) tree includes at least one HTML node, and the XML schema definition source file object tree is associated with the nodes in the first HTML tree.

[0098] S105. Define the file object tree according to the target XML schema in the preset format, and generate the second hypertext markup language tree.

[0099] The second Hypertext Markup Language (HTML) tree includes at least one HTML node, and the target XML schema definition file object tree is associated with the nodes in the second HTML tree.

[0100] S106. Display the first hypertext markup language tree and the second hypertext markup language tree to the user.

[0101] Specifically, a first hypertext markup language tree and a second hypertext markup language tree can be displayed to users on a webpage, and users can edit the first hypertext markup language tree and the second hypertext markup language tree.

[0102] For example: connecting nodes in the HTML tree of the source message with nodes in the HTML tree of the target message using a connection method, such as... Figure 5 As shown (the line starts at the `version` attribute node of `17.2AirshoppingRS` on the left and ends at the `VersionNumber` element node of `18.2AirshoppingRS` on the right), a node mapping relationship is established between the two XML message nodes, and the connection relationship is recorded in the mapping relationship array. The mapping relationship array is an array of objects, and each element identifies a pair of connection relationship nodes.

[0103] S107, Receive the mapping relationship group of nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user.

[0104] The mapping array is an array of objects, and each element in the mapping array identifies a pair of connected nodes.

[0105] Specifically, the structure of the mapping array can be as follows:

[0106]

[0107] Optionally, in another embodiment of this application, one implementation of the message conversion code generation method further includes:

[0108] The mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree is saved and persisted.

[0109] Optionally, in another embodiment of this application, one implementation of the message conversion code generation method further includes:

[0110] Receive user query requests.

[0111] The query request includes the target information.

[0112] The system queries the target information within the saved node mapping group, obtains the query results, and displays them to the user.

[0113] Continuing with the above example, the previously saved node mapping relationship can be read from storage, including: the source XML schema definition file object tree and the target XML schema definition file object tree (JS data format), as well as the node information that has been connected between the two, and then displayed again on the webpage.

[0114] Optionally, in another embodiment of this application, one implementation of the message conversion code generation method further includes:

[0115] Receive edit requests from users.

[0116] The edit request includes the information to be edited.

[0117] Edit the node mapping relationship group based on the information to be edited, and then display it to the user.

[0118] Continuing with the previous example, edit the connections on the webpage to modify the node mapping relationship.

[0119] S108. Generate message conversion code based on the mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree.

[0120] Specifically, following the syntax of the programming language, the node mapping relationship is translated into XML message conversion program code. The node mapping relationship generates XML message node conversion logic code; other non-conversion logic syntax requirements, such as root nodes and namespaces, are automatically generated using default values ​​to ensure the minimum requirements for program execution.

[0121] In the specific implementation process of the application, the XSD object tree structure of the target message is traversed, and XML tags or XLST code are generated node by node. The specific generation rules are as follows:

[0122] 1. When the node level is a leaf node and there is no connection relationship when it is used as the target in the node mapping relationship array, the node is not generated.

[0123] 2. If the node data structure (datatype) is Element, an XML tag is generated, and the tag name is taken from the lable value of the node. The generation rule for the node content is as follows:

[0124] 1) If the current node type is String or Array, the following syntax is generated, where the value of path is taken from the node mapping relationship array. When the current node is the target, it is the path value of the source node:

[0125] <Node lable>

[0126] <xsl:value-of select="$path" / >

[0127] < / Node lable>

[0128] 2) If the current node type (type) is Object, the XML tag of this node is generated continuously.

[0129] 3) If the current node type (type) is ArrayList, the following syntax is generated, where the value of path is taken from the mapping relationship array. When the current node is the target, it is the path value of the source node; each element of this node is generated under the xsl:for-each tag:

[0130] <xsl:for-each select="$path">

[0131] Element object nodes are generated here

[0132]

[0133] 3. If the node data structure (datatype) is Attribute, the following syntax is generated, where lable is the lable value of the current node and path is the path value of the source node in the mapping relationship array when the current node is the target:

[0134] <xsl:attribute name="$lable">

[0135] <xsl:value-of select="$path" / >

[0136]

[0137] 4. If the node's isMust flag is required, generate the XML tag directly; otherwise, check the isMust value of the source node corresponding to the node ID as the target node in the node mapping array. If isMust is required, generate the XML tag directly; otherwise, add xsl:if syntax to the outer layer of the generated node's XML tag, where path is taken from the path value of the source node, as follows:

[0138]

[0139] 5. In addition to the logical statements mentioned above, the XSLT file also needs to define other information such as the root element and namespace of the stylesheet in the outer layer. Specific details require adjustment based on the syntax rules of the corresponding XSLT version. The following example is for reference only:

[0140]

[0141] Following the above implementation method, the final generated xlst code in this example is shown below:

[0142]

[0143]

[0144] As can be seen from the above scheme, this application provides a method for generating message conversion codes: First, read the XML schema definition source file and the target XML schema definition file; wherein, the content of the XML schema definition source file and the target XML schema definition file is text information; then, parse the XML schema definition source file and the target XML schema definition file respectively to obtain the XML schema definition source file object tree and the target XML schema definition file object tree; wherein the node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include the following information: node identifier, node name, node type, data type, mandatory flag, node path, and collection of child node objects; then, combine the XML schema definition source file object tree and the target XML schema definition file object tree... The target XML schema definition file object tree is converted into a preset format; based on the preset format XML schema definition source file object tree, a first Hypertext Markup Language (HTML) tree is generated; based on the preset format target XML schema definition file object tree, a second HTML tree is generated; the first and second HTML trees are displayed to the user; the mapping relationship group of nodes in the first and second HTML trees edited by the user is received; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes; finally, message conversion code is generated based on the mapping relationship group of nodes in the first and second HTML trees. This achieves the goal of automatically generating conversion code, thereby assisting development work. It can also serve as a requirement design tool for NDC interface version conversion and a template for requirement analysis and discussion during the requirement confirmation phase before development. Its tree-shaped XSD structure and visual double-tree node connection function intuitively and accurately show the requirement differences between two versions of the same interface. Its connection saving function also facilitates requirement adjustment, secondary development, and other application scenarios, providing technical support for airline IT suppliers when developing Aggregator.

[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0146] The names of the messages or information exchanged between multiple devices in the embodiments of this application are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0147] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Python, Java, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0148] Another embodiment of this application provides a message conversion code generation apparatus, such as... Figure 6 As shown, it specifically includes:

[0149] The reading unit 601 is used to read the XML schema definition source file and the target XML schema definition file.

[0150] The content of the XML schema definition source file and the target XML schema definition file is text information.

[0151] Parsing unit 602 is used to parse the XML schema definition source file and the target XML schema definition file respectively, to obtain the XML schema definition source file object tree and the target XML schema definition file object tree.

[0152] The node objects of both the source and target XML schema definition file object trees include the following information: node identifier, node name, node type, data type, mandatory flag, node path, and collection of child node objects.

[0153] The conversion unit 603 is used to convert the XML schema definition source file object tree and the target XML schema definition file object tree into a preset format.

[0154] The preset format is a data format that can be recognized by front-end technology.

[0155] The first generation unit 604 is used to generate a first hypertext markup language tree by defining a source file object tree according to a preset XML pattern.

[0156] The second generation unit 605 is used to generate a second hypertext markup language tree based on the target XML schema definition file object tree in a preset format.

[0157] The first display unit 606 is used to display the first hypertext markup language tree and the second hypertext markup language tree to the user.

[0158] The first receiving unit 607 is used to receive a mapping relationship group between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user.

[0159] The mapping array is an array of objects, and each element in the mapping array identifies a pair of connected nodes.

[0160] The third generation unit 608 is used to generate message conversion code based on the mapping relationship group between the nodes in the first hypertext markup language tree and the nodes in the second hypertext markup language tree.

[0161] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, such as... Figure 1 As shown, it will not be elaborated further here.

[0162] Optionally, in another embodiment of this application, one implementation of the parsing unit 602 specifically includes:

[0163] The first parsing subunit is used to construct an XML schema definition source file object tree based on the XML code in the XML schema definition source file, according to the syntax rules of the XML schema definition file, using an object-oriented programming language.

[0164] The second parsing subunit is used to construct the target XML schema definition file object tree according to the XML code in the target XML schema definition file and the syntax rules of the XML schema definition file, using an object-oriented programming language.

[0165] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, such as... Figure 2 As shown, it will not be elaborated further here.

[0166] Optionally, in another embodiment of this application, one implementation of the message conversion code generation apparatus further includes:

[0167] The storage unit is used to store and persist the mapping relationship between the nodes in the first hypertext markup language tree and the nodes in the second hypertext markup language tree.

[0168] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, which will not be repeated here.

[0169] Optionally, in another embodiment of this application, one implementation of the message conversion code generation apparatus further includes:

[0170] The second receiving unit is used to receive user query requests.

[0171] The query request includes target information.

[0172] The query unit is used to query the target information in the saved node mapping relationship group, obtain the query results, and display them to the user.

[0173] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, which will not be repeated here.

[0174] Optionally, in another embodiment of this application, one implementation of the message conversion code generation apparatus further includes:

[0175] The third receiving unit is used to receive the user's editing request.

[0176] The edit request includes information to be edited.

[0177] The editing unit is used to edit the node mapping relationship group according to the information to be edited, and then display it to the user.

[0178] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, which will not be repeated here.

[0179] As can be seen from the above scheme, this application provides a device for generating message conversion codes: First, the reading unit 601 reads the XML schema definition source file and the target XML schema definition file; wherein, the content of the XML schema definition source file and the target XML schema definition file is text information; then, the parsing unit 602 parses the XML schema definition source file and the target XML schema definition file respectively to obtain the XML schema definition source file object tree and the target XML schema definition file object tree; wherein the node objects of the XML schema definition source file object tree and the target XML schema definition file object tree all include the following information: node identifier, node name, node type, data type, whether required flag, node path, and child node object set; the conversion unit 603 converts the XML schema definition source file object tree and the target XML schema definition file object tree into a single file. The image tree is converted into a preset format; the first generation unit 604 defines the source file object tree according to the preset format XML pattern and generates a first hypertext markup language tree; the second generation unit 605 defines the file object tree according to the preset format target XML pattern and generates a second hypertext markup language tree; the first display unit 606 displays the first hypertext markup language tree and the second hypertext markup language tree to the user; the first receiving unit 607 receives the mapping relationship group of nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes; finally, the third generation unit 608 generates message conversion code according to the mapping relationship group of nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree. This achieves the goal of automatically generating conversion code, thereby assisting development work. It can also serve as a requirement design tool for NDC interface version conversion and a template for requirement analysis and discussion during the requirement confirmation phase before development. Its tree-shaped XSD structure and visual double-tree node connection function intuitively and accurately show the requirement differences between two versions of the same interface. Its connection saving function also facilitates requirement adjustment, secondary development, and other application scenarios, providing technical support for airline IT suppliers when developing Aggregator.

[0180] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0181] Another embodiment of this application provides an electronic device, such as... Figure 7 As shown, it includes:

[0182] One or more processors 701.

[0183] Storage device 702, on which one or more programs are stored.

[0184] When one or more programs are executed by one or more processors 701, the one or more processors 701 implement the message conversion code generation method as described in any of the above embodiments.

[0185] Another embodiment of this application provides a computer storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, it implements a method for generating message conversion codes as described in any of the above embodiments.

[0186] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0187] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0188] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0189] Another embodiment of this application provides a computer program product, which, when executed, provides a method for generating message conversion codes for performing any of the above-mentioned methods.

[0190] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, it performs the functions defined in the methods of the embodiments of this application.

[0191] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

[0192] While several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of this application. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0193] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described application concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions claimed in this application.

Claims

1. A method for generating message conversion codes, characterized in that, include: Read the XML schema definition source file and the target XML schema definition file; wherein the content of the XML schema definition source file and the target XML schema definition file is text information; The XML schema definition source file and the target XML schema definition file are parsed separately to obtain the XML schema definition source file object tree and the target XML schema definition file object tree. The node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include a node identifier, node name, node type, data type, whether it is required, node path, and a collection of child node objects. The XML schema definition source file object tree and the target XML schema definition file object tree are converted into a preset format; wherein, the preset format is a data format that can be recognized by front-end technology; The source file object tree is defined according to the preset XML schema, and the first hypertext markup language tree is generated. Based on the target XML schema definition tree in the preset format, a second hypertext markup language tree is generated; Display the first hypertext markup language tree and the second hypertext markup language tree to the user; Receive a mapping relationship group between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes; Based on the mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree, generate message conversion code; The mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree is saved and persisted.

2. The generation method according to claim 1, characterized in that, The process of parsing the XML schema definition source file and the target XML schema definition file respectively to obtain the XML schema definition source file object tree and the target XML schema definition file object tree includes: Based on the XML code in the XML schema definition source file, and following the syntax rules of the XML schema definition file, an object tree of the XML schema definition source file is constructed using an object-oriented programming language. Based on the XML code in the target XML schema definition file, and following the syntax rules of the XML schema definition file, an object tree of the target XML schema definition file is constructed using an object-oriented programming language.

3. The generation method according to claim 1, characterized in that, Also includes: Receive a user's query request; wherein the query request includes target information; The target information is queried in the saved node mapping relationship group to obtain the query results and display them to the user.

4. The generation method according to claim 3, characterized in that, Also includes: Receive an editing request from a user; wherein the editing request includes information to be edited; The node mapping relationship is edited according to the information to be edited and then displayed to the user.

5. A device for generating message conversion codes, characterized in that, include: The reading unit is used to read the XML schema definition source file and the target XML schema definition file; wherein the content of the XML schema definition source file and the target XML schema definition file is text information; The parsing unit is used to parse the XML schema definition source file and the target XML schema definition file respectively, to obtain the XML schema definition source file object tree and the target XML schema definition file object tree; the node objects of the XML schema definition source file object tree and the target XML schema definition file object tree each include node identifier, node name, node type, data type, mandatory flag, node path, and a collection of child node objects; The conversion unit is used to convert the XML schema definition source file object tree and the target XML schema definition file object tree into a preset format; wherein, the preset format is a data format that can be recognized by the front-end technology; The first generation unit is used to define the source file object tree according to the preset format XML pattern and generate the first hypertext markup language tree; The second generation unit is used to generate a second hypertext markup language tree based on the target XML schema definition file object tree in a preset format. The first display unit is used to display the first hypertext markup language tree and the second hypertext markup language tree to the user; The first receiving unit is used to receive a mapping relationship group between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree edited by the user; wherein, the mapping relationship array is an object array, and each element in the mapping relationship array identifies a pair of connected nodes; The third generation unit is used to generate message conversion code based on the mapping relationship between nodes in the first hypertext markup language tree and nodes in the second hypertext markup language tree; The storage unit is used to store and persist the mapping relationship between the nodes in the first hypertext markup language tree and the nodes in the second hypertext markup language tree.

6. The generating apparatus according to claim 5, characterized in that, The parsing unit includes: The first parsing subunit is used to construct an XML schema definition source file object tree according to the XML code in the XML schema definition source file and the syntax rules of the XML schema definition file, using an object-oriented programming language. The second parsing subunit is used to construct the target XML schema definition file object tree according to the XML code in the target XML schema definition file and the syntax rules of the XML schema definition file, using an object-oriented programming language.

7. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the message conversion code generation method as described in any one of claims 1 to 4.

8. A computer storage medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the method for generating message conversion codes as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and system of document transformation between a source extensible markup language (XML) schema and a target XML schema

    US20030167445A1