Method and device for generating XML (Extensible Markup Language) file
By storing the query results in a distributed server to the local disk, and using the cloud server to distribute the query content, the memory overflow problem when generating XML files is solved, and the stability and security of the system when processing big data.
Patent Information
- Application Number
- CN202411368133.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-09-29
AI Technical Summary
In the process of generating XML files, the prior art is prone to memory overflow problems, especially when the amount of data is large.
The query results are stored to the local disk by the distributed server, and the cloud server is distributed to the distribution server to avoid processing a large amount of data directly in the memory to achieve the XML file process that does not overflow the memory.
It effectively solves the memory overflow problem when generating XML files and ensures the stability and security of the system when processing big data.
Smart Images

Figure CN119336257A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method and device for generating an XML file. Background Art
[0002] In enterprise communication scenarios, Extensible Markup Language (XML) is generally used as communication messages for data transmission.
[0003] At present, it is generally based on Java language, to obtain data from the data source and store it in the cache, and then to splice the obtained data. If the amount of data required to generate the XML file is large, there will be a memory overflow problem in the process of obtaining and splicing data.
[0004] In summary, how to solve the problem of memory overflow in the process of generating XML files is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiment of the present invention provides a method and device for generating an XML file, which are used to solve the problem of memory overflow in the process of generating an XML file in the prior art.
[0006] In the first aspect, an embodiment of the present invention provides a method for generating an XML file, comprising: a distribution server sends multiple target query requests to a distributed server; any target query request is used to obtain a query result including at least one query content; the query result is obtained by the distributed server from the target data source and stored in the local disk; for any target query request, the distribution server receives query information sent by the distributed server; the query information is obtained through the query result of the target query request; the query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by a cloud server based on any query content sent by the distributed server; the data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and at least one query content; for any target query request, the distribution server obtains query content corresponding to at least one query ID from the cloud server according to at least one query ID corresponding to the query result of the target query request; the distribution server generates a query object according to the query content corresponding to the at least one query ID and the data structure information of the query result; the distribution server generates XML files corresponding to multiple target query requests according to multiple query objects corresponding to multiple target query requests.
[0007] In the above technical solution, since the amount of data to be queried is large, when the distributed server obtains the query results from the target data source, the query results will be stored in the local disk, so as to achieve the problem of memory overflow in the process of obtaining the query results. Since the amount of data in the query results is large, in order to prevent the distributed server from directly sending the query results to the distribution server and causing the memory overflow of the distribution server, the distributed server stores at least one query content in the query results to the cloud server. In this case, the distribution server will obtain the query content from the cloud server through the query ID, and then restore the query results with data structure according to the data structure information and the query content, and generate an XML file according to the query results.
[0008] Optionally, the distribution server sends multiple target query requests to the distributed server, including: the distribution server receives multiple query requests; any query request includes query identity information and query content information; the distribution server classifies the multiple query requests according to the query identity information in any query request to obtain multiple query request groups; each query request group corresponds to a query identity information; for any query request group, the distribution server classifies the multiple query requests in the query request group into individual query requests and common query requests according to the query content information of the multiple query requests in the query request group; and determines the individual query requests and common query requests corresponding to each query request group as multiple target query requests.
[0009] Optionally, the query result of any target query request is determined in the following manner: the distributed server obtains the query result corresponding to the target query request from the target data source; the query result includes at least one query content with the same query identity information; the distributed server traverses the query result, determines the data structure information of the query result, and splits the query result into at least one query content and stores them separately in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it to the local disk; the distributed server clears the cache array and continues to obtain query results until the query results are stored to the local disk.
[0010] Optionally, the query ID is determined in the following manner: the distributed server sends multiple serialized query contents in the local disk to the cloud server; the cloud server generates a query ID corresponding to each serialized query content and sends it to the distributed server.
[0011] Optionally, before the distribution server generates a query object based on the query content and query result data structure information corresponding to at least one query ID, the distribution server also includes: the distribution server deserializes the serialized query content obtained from the cloud server according to at least one query ID, obtains at least one query content and stores it in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in the local disk; the distribution server clears the cache array and continues to obtain query content until all query content is stored in the local disk.
[0012] Optionally, the distribution server generates a query object based on the query content corresponding to at least one query ID and the data structure information of the query result, including: the distribution server obtains each serialized query content corresponding to the query result from the local disk and deserializes it; and generates multiple deserialized query contents into a query object based on the data structure information of the query result.
[0013] Optionally, the distribution server generates XML files corresponding to multiple target query requests based on multiple query objects corresponding to the multiple target query requests, including: the distribution server assigns any query object to an external object, and the external object is provided with annotation information; the distribution server creates XML nodes for each query object and / or each external object to generate XML files corresponding to the multiple target query requests.
[0014] In a second aspect, an embodiment of the present invention provides a method for generating an XML file, comprising: a distributed server receives multiple target query requests sent by a distribution server; the distributed server obtains query results of the target query requests from a target data source based on the multiple target query requests; the distributed server traverses the query results, determines the data structure information of the query results, and stores the query results to a local disk; the query results include at least one query content; the data structure information is used to characterize the affiliation between the query results and at least one query content; the distributed server sends the query results to a cloud server; the distributed server receives a query ID sent by the cloud server; any query ID is generated by the cloud server based on any query content sent by the distributed server; the distributed server determines the query information based on the query ID of at least one query content in the query result and the data structure information of the query result, and sends it to the distribution server; the query information is used by the distribution server to obtain the query content corresponding to at least one query ID from the cloud server, and generate an XML file based on the query content.
[0015] Optionally, the distributed server obtains query results of the target query requests from the target data source based on multiple target query requests, including: the distributed server obtains the query results corresponding to the target query requests from the target data source; the query results include at least one query content with the same query identity information; the distributed server traverses the query results, determines the data structure information of the query results, and splits the query results into at least one query content and stores them separately in a cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it in the local disk; the distributed server clears the cache array and continues to obtain query results until the query results are stored in the local disk.
[0016] In a third aspect, an embodiment of the present invention provides a device for generating an XML file, comprising: a sending unit for sending multiple target query requests to a distributed server; any target query request is used to obtain a query result including at least one query content; the query result is obtained by the distributed server from the target data source and stored in the local disk; a first processing unit is used to receive query information sent by the distributed server for any target query request; the query information is obtained through the query result of the target query request; the query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by a cloud server based on any query content sent by the distributed server; the data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and at least one query content; for any target query request, the query content corresponding to at least one query ID is obtained from the cloud server according to at least one query ID corresponding to the query result of the target query request; a query object is generated according to the query content corresponding to at least one query ID and the data structure information of the query result; and XML files corresponding to multiple target query requests are generated according to multiple query objects corresponding to multiple target query requests.
[0017] Optionally, the sending unit is specifically used to: receive multiple query requests; any query request includes query identity information and query content information; classify the multiple query requests according to the query identity information in any query request to obtain multiple query request groups; each query request group corresponds to a query identity information; for any query request group, according to the query content information of the multiple query requests in the query request group, divide the multiple query requests in the query request group into individual query requests and common query requests; determine the individual query requests and common query requests corresponding to each query request group as multiple target query requests.
[0018] Optionally, the query result of any target query request is determined in the following manner: the distributed server obtains the query result corresponding to the target query request from the target data source; the query result includes at least one query content with the same query identity information; the distributed server traverses the query result, determines the data structure information of the query result, and splits the query result into at least one query content and stores them separately in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it to the local disk; the distributed server clears the cache array and continues to obtain query results until the query results are stored to the local disk.
[0019] Optionally, the query ID is determined in the following manner: the distributed server sends multiple serialized query contents in the local disk to the cloud server; the cloud server generates a query ID corresponding to each serialized query content and sends it to the distributed server.
[0020] Optionally, the first processing unit is also used for: the distribution server deserializes the serialized query content obtained from the cloud server according to at least one query ID, obtains at least one query content and stores it in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in the local disk; the distribution server clears the cache array and continues to obtain query content until all query content is stored in the local disk.
[0021] Optionally, the first processing unit is specifically used to: obtain each serialized query content corresponding to the query result from the local disk and perform deserialization processing; and generate multiple deserialized query contents into a query object according to the data structure information of the query result.
[0022] In a fourth aspect, an embodiment of the present invention provides a device for generating an XML file, comprising: an acquisition unit for acquiring query results of target query requests from a target data source according to multiple target query requests; traversing the query results, determining data structure information of the query results, and storing the query results to a local disk; the query results include at least one query content; the data structure information is used to characterize the affiliation between the query results and at least one query content; a second processing unit is used to send the query results to a cloud server; receiving a query ID sent by the cloud server; any query ID is generated by the cloud server based on any query content sent by a distributed server; determining the query information based on the query ID of at least one query content in the query result and the data structure information of the query result and sending it to the distribution server; the query information is used for the distribution server to obtain the query content corresponding to at least one query ID from the cloud server, and generate an XML file based on the query content.
[0023] Optionally, the acquisition unit is specifically used to: obtain the query result corresponding to the target query request from the target data source; the query result includes at least one query content with the same query identity information; traverse the query results, determine the data structure information of the query results, and split the query results into at least one query content and store them separately in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the query content in the cache array is serialized and stored in the local disk; the cache array is cleared and the query results continue to be obtained until the query results are stored in the local disk.
[0024] In a fifth aspect, an embodiment of the present application further provides a computing device, comprising: a memory for storing programs; a processor for calling the programs stored in the memory, and executing a method for generating an XML file as in the first aspect according to the obtained program.
[0025] In a sixth aspect, an embodiment of the present application further provides a computer-readable non-volatile storage medium, comprising a computer-readable program. When a computer reads and executes the computer-readable program, the computer executes a method for generating an XML file as in the first aspect.
[0026] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer device, the computer device executes the steps of a method for generating an XML file in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0028] Figure 1 A flow chart of a method for generating an XML file provided by an embodiment of the present invention;
[0029] Figure 2 A flow chart of a method for screening query requests provided by an embodiment of the present invention;
[0030] Figure 3 A flow chart of a method for obtaining query results provided by an embodiment of the present invention;
[0031] Figure 4 A flow chart of a method for uploading query content to a cloud server provided in an embodiment of the present invention;
[0032] Figure 5 A flow chart of a method for obtaining query content from a cloud server provided by an embodiment of the present invention;
[0033] Figure 6 A flow chart of a method for generating a query object provided by an embodiment of the present invention;
[0034] Figure 7 A flow chart of a method for generating an XML file provided by an embodiment of the present invention;
[0035] Figure 8 A schematic diagram of the structure of a device for generating an XML file provided by an embodiment of the present invention;
[0036] Fig. 9 A schematic diagram of the structure of a device for generating an XML file provided by an embodiment of the present invention;
[0037] Fig.10 A schematic diagram of the structure of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] like Figure 1FIG. 1 is a flow chart of a method for generating an XML file provided by an embodiment of the present invention, the method comprising the following steps:
[0040] Step 101: The distribution server sends multiple target query requests to the distributed servers.
[0041] In the embodiment of the present invention, any target query request is used to obtain query results including at least one query content; since the number of query results required to generate XML files is large, if they are directly stored in the cache, memory overflow will occur. Therefore, the distributed server obtains the query results from the target data source and stores them in the local disk, so that the memory does not overflow in the process of obtaining the query results from the distributed server. The target data source can be a database, a data folder, or other data sources, which are not limited here.
[0042] Step 102: For any target query request, the distribution server receives query information sent by the distributed server.
[0043] In an embodiment of the present invention, a distributed server obtains multiple query information based on multiple target query requests, wherein the query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by the cloud server based on any query content sent by the distributed server; the data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and at least one query content.
[0044] Step 103: for any target query request, the distribution server obtains query content corresponding to at least one query ID from the cloud server according to at least one query ID corresponding to the query result of the target query request.
[0045] In order to subsequently generate an XML file, the distribution server in the embodiment of the present invention can obtain the query content corresponding to the query ID from the cloud server according to the query ID sent by the distributed server to the distribution server.
[0046] Step 104: The distribution server generates a query object according to the query content and the data structure information of the query result corresponding to at least one query ID.
[0047] In the embodiment of the present invention, since there is a subordinate relationship between multiple query contents and query results, the internal data of the query contents also has a data structure. Therefore, the distribution server needs to generate a query object with a data structure according to the data structure information of the query contents and query results.
[0048] Step 105: The distribution server generates XML files corresponding to the multiple target query requests according to the multiple query objects corresponding to the multiple target query requests.
[0049] In the embodiment of the present invention, after the distribution server obtains multiple query objects, it can generate multiple XML files corresponding to target query requests according to the multiple query objects.
[0050] It can be seen from the above steps 101 to 105 that, due to the large amount of data to be queried, when the distributed server obtains the query results from the target data source, the query results will be stored in the local disk, so as to achieve the problem of memory overflow in the process of obtaining the query results. Due to the large amount of data in the query results, in order to prevent the distributed server from directly sending the query results to the distribution server and causing the memory overflow of the distribution server, the distributed server stores at least one query content in the query results to the cloud server. In this case, the distribution server will obtain the query content from the cloud server through the query ID, and then restore the query results with data structure according to the data structure information and the query content, and generate an XML file according to the query results.
[0051] Since the amount of data that needs to be queried is large and the content that needs to be queried in the query request is large, the distribution server needs to integrate the query requests before sending them to the distributed server, and filter out some duplicate query content. This can reduce the distribution workload of the distribution server, reduce the subsequent network transmission volume between the distribution server and the distributed server, and reduce the load pressure on the distributed server.
[0052] like Figure 2 FIG. 1 is a flow chart of a method for screening query requests provided by an embodiment of the present invention, the method comprising the following steps:
[0053] Step 201: The distribution server receives multiple query requests.
[0054] In the embodiment of the present invention, the distribution server receives multiple query requests. Since the number of query requests is large, it is necessary to filter out duplicate query requests to reduce the distribution workload of the distribution server.
[0055] Step 202: The distribution server classifies multiple query requests according to the query identity information in any query request to obtain multiple query request groups.
[0056] In an embodiment of the present invention, the queried identity information includes an account number, a card number, and an ID number, and may also be other information proving the identity information, which is not limited here. First, according to the queried identity information, multiple query requests are classified, and the query information of the same query identity information is grouped together to obtain multiple query request groups. For example, the distribution server receives multiple query requests, namely query request A, query request B, and query request C, wherein the account information of query request A is account 1, the account information of query request B is account 2, and the account information of query request C is account 1. Since the query identity information of query request A and query request C are both account 1, query request A and query request C are classified into the same query request group. Any query request group corresponds to the same object; each query request group corresponds to a query identity information;
[0057] Step 203: for any query request group, the distribution server divides the multiple query requests in the query request group into individual query requests and common query requests according to the query content information of the multiple query requests in the query request group.
[0058] In the embodiment of the present invention, the query content information includes customer information, account information, financial information, transaction details and other information, and may also be other information representing the content, which is not limited here. After classifying multiple query requests, for any query request of the same query request group, a bitmap vector string is generated according to the query content information, where 0 indicates no query and 1 indicates query. For example, if the account information of query request A, query request B and query request C are all account 1, that is, the three query requests are classified into one category, and the bitmap vector strings of the three query requests can be viewed through Table 1:
[0059]
[0060] Among them, the bitmap vector string of query request A is 11010, the bitmap vector string of query request B is 11110, and the bitmap vector string of query request C is 10110. By taking the intersection of the bitmap vector strings of these three query requests, that is, 11010∩11110∩10110=10010. According to the result of the intersection, it can be seen that these three query requests need to query customer information and transaction details, that is, the common query content information is customer information and transaction details, among which query request A separately queries the content information of account information, query request B separately queries the content information of account information and financial information, and query request C separately queries the content information of customer information and financial information. Therefore, by splitting multiple target query requests of the same query request group into common query content information and separate query content information, that is, splitting the content to be queried into common query content and separate query content, by determining the common query content, the number of queries for customer information and transaction details is reduced from 3 times to 1 time, thereby reducing the number of queries.
[0061] Step 204: determine the individual query requests and the common query requests corresponding to each query request group as a plurality of target query requests.
[0062] In the embodiment of the present invention, for any query request group, the target query request of the query request group includes a separate query request and a common query request. The query identity information of any target query request is the same. One query request group corresponds to one target query request.
[0063] It can be seen from the above steps 201 to 204 that by determining the content of the public query, repeated query content information is screened out, thereby reducing the number of queries, further reducing the amount of data transmission, and saving subsequent storage space and distributed server resource loss.
[0064] In the embodiment of the present invention, the distribution server screens out some repeated query contents, determines the target query request, and then sends the target query request to the distributed server. The distributed server obtains the query result corresponding to the target query request from the target data source according to the target query request.
[0065] In one possible case, if the XML document is generated based on Java language by splicing nodes, ArrayLIST is a commonly used LIST in Java, which uses a cache array to store elements internally, where the cache array can be Object[]elementData. The query results are obtained from the target data source through a query request, and the query results are stored in the Object[]elementData array. Specifically, through the add(E e) method of ArrayLIST, this method will first increase the cache array elementData by 1 to expand the capacity, and then store the query results in the cache array elementData. If the number of elements stored in ArrayLIST is very large, then the cache array elementData will be very large, which may cause memory overflow.
[0066] An embodiment of the present invention provides a method for obtaining query results, which is used to solve the problem of memory overflow caused in the process of obtaining query results corresponding to a target query request from a target data source.
[0067] like Figure 3 FIG. 1 is a flow chart of a method for obtaining query results provided by an embodiment of the present invention, the method comprising the following steps:
[0068] Step 301: The distributed server obtains a query result corresponding to a target query request from a target data source.
[0069] In the embodiment of the present invention, the distributed server obtains the query result corresponding to the target query request from the target data source according to the target query request.
[0070] Step 302: the distributed server traverses the query result, determines the data structure information of the query result, and splits the query result into at least one query content and stores them respectively into the cache array defined in the LIST interface.
[0071] In the embodiment of the present invention, at least one query content in the query result has a subordinate relationship with the query result, and the internal data of the query content also has a data structure relationship. For example, the query result includes customer information, financial information, transaction details, freezing information, and account information. Since the data volume of any query result is large, if the query result is directly stored in the cache, it will directly lead to the problem of memory overflow. Therefore, since the target query request includes a separate query request and a public query request, the distributed server obtains at least one query content in the query result according to the target query request, and then traverses the entire query result, determines the data structure information of the query result, and splits the query result into at least one query content, and then stores them separately in the cache array defined in the LIST interface. The capacity limit of the cache data can be adjusted dynamically, which can take into account the efficiency of storing files and avoid memory overflow and cause the entire system to crash.
[0072] Step 303: When the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it in the local disk.
[0073] In the embodiment of the present invention, since the cache array has a set length, when the cache data reaches the capacity limit, the distributed server will perform JSON serialization processing on the query content in the cache array to obtain a JSON string, and store the JSON string to the local disk, so as to achieve that there will be no memory overflow problem in the process of obtaining the query result. For example, in the custom LIST collection class, the underlying core logic is rewritten, and the add(E e) method is assigned and called. Add(E e) is a method of the standard interface LIST. If the data volume of the query result is particularly large, if add(E e) is called continuously for tens of millions of data, then Java's memory will definitely overflow. Define a cache array in LIST. When add(E e) is called, e is temporarily placed in the cache array. When the data in the cache array reaches the cache value, such as 1000, a temporary file in the local disk is created, the object list in the cache array is looped, and the query content in the cache array is serialized and stored in a temporary file in the local disk. When add(E e) is called again, the cache array is initialized again and storage starts from 1.
[0074] Step 304: The distributed server clears the cache array and continues to obtain query results until the query results are stored in the local disk.
[0075] In the embodiment of the present invention, since the query content in the cache array has been stored in the local disk, in order to prevent the problem of memory overflow, the distributed server clears the cache array and continues to obtain query results until the query results are stored in the local disk.
[0076] It can be seen from the above steps 301 to 304 that by transferring the query results to the local disk, the problem of memory overflow can be prevented, and the preset threshold can be adjusted dynamically, thereby ensuring the efficiency of storing the query results and avoiding the problem of memory overflow.
[0077] Optionally, since any target query request includes a public query request and a separate query request, any public query request or any separate query request is used to request the corresponding query content from the target data source. Therefore, any query result is composed of at least one query content, wherein any query result has data structure information, and the data structure information is used to characterize the affiliation between the query result and at least one query content, as well as the internal data structure relationship of any query content. The distribution server needs the query content and the data structure information of the query result to generate an XML file. Therefore, the query result needs to be sent to the distribution server.
[0078] Optional, if the query result is saved as personal information Customer, the personal information Customer includes a transaction details List <traninfo>、Financial Information List <fininfo>, where transaction details List <traninfo>Contains 10 million TranInfo objects and financial information List <fininfo>Contains 20 million objects; because of the custom RemoteFileStreamList, there will be no memory overflow during the storage process. In order to return the query result Customer to the distribution server, it needs to be serialized to generate a result message, such as a JSON string. However, if the object Customer is serialized directly, the transaction details List will be directly <traninfo>10 million TranInfo objects (assuming the object contains 10 fields), financial information List <fininfo>If all objects in the 20 million FinInfo objects (assuming that the object contains 10 fields) are serialized into JSON strings, there is a risk of memory overflow due to their extremely large data volume (10 million*10+20 million*10=300 million fields).
[0079] In one possible case, the distributed server sends a JSON string of at least one query content of the query result and the data structure information of the query result to the distribution server, and the distribution server deserializes the JSON string and stores it in the cache array. When the limit of the cache array is reached, the distribution server stores the query content in the local disk, and then the distribution server clears the cache array and continues to obtain the query content until all the query content is stored in the local disk. The distribution server then generates a query object based on the data structure information and the query content, so as to facilitate the subsequent generation of an XML file based on the query object.
[0080] In another possible case, the present invention introduces a cloud server, and the distributed server uploads the query content to the cloud server and sends the data structure information to the distribution server. In this way, the distribution server obtains the query content from the cloud server, and then determines the query object based on the query content and the data structure information.
[0081] Therefore, an embodiment of the present invention provides a flow chart of a method for uploading query content to a cloud server, the method comprising the following steps:
[0082] like Figure 4 FIG. 1 is a flow chart of a method for uploading query content to a cloud server provided by an embodiment of the present invention, and the method includes the following steps:
[0083] Step 401: The distributed server sends multiple serialized query contents in the local disk to the cloud server.
[0084] In the embodiment of the present invention, the distributed server sends a plurality of serialized query contents in the local disk to the cloud server, so that it is convenient for the subsequent distribution server to obtain the query contents from the cloud server.
[0085] Step 402: The cloud server generates a query ID corresponding to each serialized query content and sends it to the distributed server.
[0086] In the embodiment of the present invention, the cloud server generates a corresponding query ID and a corresponding check value for any query content after serialization, and then sends the query ID and the check value to the distributed server. When the distributed server receives the query ID and the check value, the distributed server clears the temporary file in the local disk. The query ID is the query content after serialization that the subsequent distribution server obtains from the cloud server according to the query ID, and the check value is the MD5 value used to verify the integrity of the query content after serialization.
[0087] It can be seen from the above steps 401 to 402 that the distributed server uploads the query content to the cloud server. In this way, the distributed server will not directly send the query results to the distribution server to cause memory overflow problems. The distributed server will perform JSON serialization on the query ID and the check value, and send the serialized query ID and check value to the distribution server. The distribution server can obtain the query content from the cloud server in sequence according to the query ID.
[0088] In the embodiment of the present invention, the distributed server performs JSON serialization on the query ID and the check value, and sends the serialized query ID and check value to the distribution server. Specifically, the distributed server customizes a RemoteFileStreamListAdapter, inherits the TypeAdapter of GSON, and calls write(JSONWriter out, RemoteFileStreamList<?>value) during serialization. The write method only serializes the query ID, check value, and query result data structure information and sends it to the distribution server, so that the transaction details List will not be <traninfo>、Financial Information List <fininfo>All data in the distribution server is serialized, so that the distribution server will not have memory overflow problems.
[0089] The following describes how the distribution server obtains query content from the cloud server and how to prevent memory overflow during the process of obtaining the query content.
[0090] like Figure 5 FIG. 1 is a flow chart of a method for obtaining query content from a cloud server provided by an embodiment of the present invention, and the method includes the following steps:
[0091] Step 501: The distribution server deserializes the serialized query content obtained from the cloud server according to at least one query ID, obtains at least one query content and stores it in the cache array defined in the LIST interface.
[0092] In an embodiment of the present invention, the distribution server receives the serialized query ID and the serialized check value sent by the distributed server, and performs deserialization processing to obtain the query ID and the check value. Then, the distribution server obtains the serialized query content from the cloud server according to the query ID, and performs deserialization processing to obtain at least one query content, and stores it in the cache array defined in the LIST interface. For example, the read(JsonReader in) deserialization method of the custom RemoteFileStreamListAdapter, the read method stores the JSON fildId value and fileHash value as the attribute fields fildId and fileHash of the object RemoteFileStreamList, respectively, and then the read method returns the object RemoteFileStreamList. <e>. Thus, the Customer object and its attribute transaction details List are restored <traninfo>、Financial Information List <fininfo>When RemoteFileStreamList is initialized, the distribution server will call the cloud file server to obtain the result file of the distributed server query based on the fildId value and the fileHash value, and save it as a temporary file tempRemote.json on the local disk.
[0093] Step 502: When the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in the local disk.
[0094] In the embodiment of the present invention, in order to prevent the memory overflow problem of the distribution server, when the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in a temporary file in the local disk.
[0095] Step 503: The distribution server clears the cache array and continues to obtain query content until all query content is stored in the local disk.
[0096] In the embodiment of the present invention, the distribution server clears the cache array, that is, initializes the cache array, and then continues to obtain query content from the cloud server according to the query ID until all query content is stored in a temporary file in the local disk.
[0097] It can be seen from the above steps 501 to 503 that by setting the cache array, the memory is prevented from overflowing during the process of the distribution server acquiring the query content.
[0098] After the distribution server stores the query content to the local disk, the distribution server generates a query object according to the query content and the data structure information of the query result.
[0099] like Figure 6 FIG. 1 is a flow chart of a method for generating a query object provided by an embodiment of the present invention, the method comprising the following steps:
[0100] Step 601: The distribution server obtains each serialized query content corresponding to the query result from the local disk and performs deserialization processing.
[0101] In the embodiment of the present invention, since the distribution server obtains the query content processed by JSON serialization, the distribution server first needs to obtain each serialized query content corresponding to the query result from the temporary file of the local disk and perform deserialization processing. For example, the distribution server calls the custom RemoteFileStreamList traversal method next(), which implements the standard interface Iterator. Each time the next() method is called, only one JSON string of data is taken out from the temporary file and deserialized.
[0102] Step 602: Generate a plurality of deserialized query contents into a query object according to the data structure information of the query result.
[0103] In the embodiment of the present invention, since the query object has a data structure, the deserialized query content can be used to generate a query object according to the data structure information of the query result, wherein the internal data of the query content in the query object has a data structure, and there is a subordinate relationship between the query content and the query result. Therefore, the distribution server deserializes the serialized data structure information, and then generates multiple deserialized query contents into query objects according to the data structure information of the query result.
[0104] It can be seen from the above steps 601 to 602 that the distribution server can restore the query result, that is, the query object, according to the data structure information and the query content corresponding to the query result.
[0105] like Figure 7 FIG. 1 is a flow chart of a method for generating an XML file provided by an embodiment of the present invention, the method comprising the following steps:
[0106] Step 701: the distribution server assigns any query object to an external object, where the external object is provided with annotation information.
[0107] In the embodiment of the present invention, the distribution server assigns annotation information to any query object. In this way, since the object is annotated, it is convenient to subsequently splice multiple query objects with annotation information to obtain an XML file. For example, the returned query object E is assigned to the external object T, and the add(T t) method of the custom FileStreamList collection class is called. add(T t) is the method for adding the standard interface List. The external object T will be defined as different objects T depending on the external access party. For example, for the same account information, access party A defines the object as Ta, where the annotation of the account is: @XmlElement(name="ACCT_NO"), and access party B defines the object as Tb, where the annotation of the account is: @XmlElement(name="accountNo"), so different XML tags can be generated according to different annotations.<ACCT_NO> , <accountno>In this way, different access parties only need to define different objects T and annotation tags, which can easily expand the generation function of large XML files.
[0108] Step 702: The distribution server creates XML nodes for each query object and / or each external object to generate XML files corresponding to multiple target query requests.
[0109] In the embodiment of the present invention, when the distribution server calls add(T t) of FileStreamList and reaches the set cache value, the object T in its memory is serialized into JSON and persisted in the XML folder in the local disk, and the memory object is cleared at the same time.
[0110] It can be seen from the above steps 701 to 702 that the structure of the XML file is intuitively reflected through the attributes of the object by using annotations, and the hierarchical relationship of the parent and child nodes of the XML is reflected through the collection of objects, so that the query objects can be quickly and easily spliced according to the annotation information to obtain the XML file.
[0111] Based on the same technical concept, the embodiment of the present application provides a device for generating an XML file, such as Figure 8 As shown, the device 800 includes: a sending unit 801 for sending multiple target query requests to a distributed server; any target query request is used to obtain a query result including at least one query content; the query result is obtained by the distributed server from the target data source and stored in the local disk; a first processing unit 802 is used to receive query information sent by the distributed server for any target query request; the query information is obtained through the query result of the target query request; the query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by the cloud server based on any query content sent by the distributed server; the data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and at least one query content; for any target query request, the query content corresponding to at least one query ID is obtained from the cloud server according to at least one query ID corresponding to the query result of the target query request; a query object is generated according to the query content corresponding to at least one query ID and the data structure information of the query result; and XML files corresponding to multiple target query requests are generated according to multiple query objects corresponding to multiple target query requests.
[0112] Optionally, the sending unit 801 is specifically used to: receive multiple query requests; any query request includes query identity information and query content information; classify the multiple query requests according to the query identity information in any query request to obtain multiple query request groups; each query request group corresponds to a query identity information; for any query request group, according to the query content information of the multiple query requests in the query request group, divide the multiple query requests in the query request group into individual query requests and common query requests; determine the individual query requests and common query requests corresponding to each query request group as multiple target query requests.
[0113] Optionally, the query result of any target query request is determined in the following manner: the distributed server obtains the query result corresponding to the target query request from the target data source; the query result includes at least one query content with the same query identity information; the distributed server traverses the query result, determines the data structure information of the query result, and splits the query result into at least one query content and stores them separately in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it to the local disk; the distributed server clears the cache array and continues to obtain query results until the query results are stored to the local disk.
[0114] Optionally, the query ID is determined in the following manner: the distributed server sends multiple serialized query contents in the local disk to the cloud server; the cloud server generates a query ID corresponding to each serialized query content and sends it to the distributed server.
[0115] Optionally, the first processing unit 802 is also used for: the distribution server deserializes the serialized query content obtained from the cloud server according to at least one query ID, obtains at least one query content and stores it in the cache array defined in the LIST interface; the cache array has a set length; when the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in the local disk; the distribution server clears the cache array and continues to obtain query content until all query content is stored in the local disk.
[0116] Optionally, the first processing unit 802 is specifically configured to: obtain each serialized query content corresponding to the query result from the local disk and perform deserialization processing; and generate multiple deserialized query contents into a query object according to the data structure information of the query result.
[0117] Based on the same technical concept, the embodiment of the present application provides a device for generating an XML file, such as Fig. 9 As shown, the device 900 includes: an acquisition unit 901 is used to acquire a query result of a target query request from a target data source according to multiple target query requests; traverse the query result, determine the data structure information of the query result, and store the query result to a local disk; the query result includes at least one query content; the data structure information is used to characterize the affiliation between the query result and the at least one query content;
[0118] The second processing unit 902 is used to send the query results to the cloud server; receive the query ID sent by the cloud server; any query ID is generated by the cloud server based on any query content sent by the distributed server; determine the query information based on the query ID of at least one query content in the query result and the data structure information of the query result and send it to the distribution server; the query information is used by the distribution server to obtain the query content corresponding to at least one query ID from the cloud server, and generate an XML file based on the query content.
[0119] Optionally, the acquisition unit 901 is specifically used to: obtain a query result corresponding to a target query request from a target data source; the query result includes at least one query content having the same query identity information; traverse the query result, determine the data structure information of the query result, and split the query result into at least one query content and store them separately in a cache array defined in a LIST interface; the cache array has a set length; when the cache array reaches a capacity limit, the query content in the cache array is serialized and stored in a local disk; the cache array is cleared and the query results continue to be obtained until the query results are stored in the local disk.
[0120] Based on the same technical concept, the present application embodiment provides a computing device, such as Fig.10 As shown, it includes at least one processor 1001 and a memory 1002 connected to the at least one processor. The specific connection medium between the processor 1001 and the memory 1002 is not limited in the embodiment of the present application. Fig.10 For example, the processor 1001 and the memory 1002 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0121] In the embodiment of the present application, the memory 1002 stores instructions that can be executed by at least one processor 1001, and the at least one processor 1001 can perform the above-mentioned steps of generating an XML file by executing the instructions stored in the memory 1002.
[0122] Among them, the processor 1001 is the control center of the computing device, which can use various interfaces and lines to connect various parts of the computing device, and process the generated XML file by running or executing instructions stored in the memory 1002 and calling data stored in the memory 1002.
[0123] Optionally, the processor 1001 may include one or more processing units, and the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may also be integrated into the processor 1001. In some embodiments, the processor 1001 and the memory 1002 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.
[0124] Processor 1001 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor to be executed, or can be executed by a combination of hardware and software modules in the processor.
[0125] Memory 1002, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory 1002 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, optical disk, etc. Memory 1002 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer device, but is not limited thereto. The memory 1002 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0126] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program executable by a computer device. When the program runs on the computer device, the computer device executes the steps of the above-mentioned method for generating an XML file.
[0127] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0128] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 produce 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.
[0129] 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.
[0130] 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.
[0131] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.< / accountno> < / fininfo> < / traninfo> < / e> < / fininfo> < / traninfo> < / fininfo> < / traninfo> < / fininfo> < / traninfo> < / fininfo> < / traninfo>
Claims
1. A method for generating an extensible markup language XML file, characterized in that: include: The distribution server sends multiple target query requests to the distributed servers; Any target query request is used to obtain a query result including at least one query content; The query result is obtained by the distributed server from the target data source and stored in the local disk; For any target query request, the distribution server receives the query information sent by the distributed server; The query information is obtained through the query result of the target query request; The query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by the cloud server based on any query content sent by the distributed server; The data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and the at least one query content; For any target query request, the distribution server obtains query content corresponding to the at least one query ID from the cloud server according to at least one query ID corresponding to the query result of the target query request; The distribution server generates a query object according to the query content corresponding to the at least one query ID and the data structure information of the query result; The distribution server generates XML files corresponding to the multiple target query requests according to the multiple query objects corresponding to the multiple target query requests.
2. The method according to claim 1, characterized in that The distributor sends multiple target query requests to the distributed servers, including: The distribution server receives multiple query requests; any query request includes query identity information and query content information; The distribution server classifies the multiple query requests according to the query identity information in any query request to obtain multiple query request groups; each query request group corresponds to one query identity information; For any query request group, the distribution server divides the multiple query requests in the query request group into separate query requests and common query requests according to the query content information of the multiple query requests in the query request group; The individual query requests and the common query requests corresponding to each query request group are determined as a plurality of target query requests.
3. The method according to claim 1, characterized in that The query result of any target query request is determined as follows: The distributed server obtains a query result corresponding to the target query request from the target data source; the query result includes at least one query content having the same query identity information; The distributed server traverses the query result, determines the data structure information of the query result, and splits the query result into at least one query content and stores them respectively in a cache array defined in the LIST interface; the cache array has a set length; When the cache array reaches the capacity limit, the distributed server serializes the query content in the cache array and stores it in the local disk; The distributed server clears the cache array and continues to obtain the query results until the query results are stored in the local disk.
4. The method according to claim 3, characterized in that The query ID is determined as follows: The distributed server sends the multiple serialized query contents in the local disk to the cloud server; The cloud server generates a query ID corresponding to each serialized query content and sends it to the distributed server.
5. The method according to claim 1, characterized in that Before the distribution server generates a query object according to the query content corresponding to the at least one query ID and the data structure information of the query result, the distribution server further includes: The distribution server deserializes the serialized query content obtained from the cloud server according to the at least one query ID, obtains at least one query content and stores it in a cache array defined in the LIST interface; the cache array has a set length; When the cache array reaches the capacity limit, the distribution server serializes the content in the cache array and stores it in the local disk; The distribution server clears the cache array and continues to obtain query content until all query content is stored in the local disk.
6. The method according to claim 5, characterized in that The distribution server generates a query object according to the query content corresponding to the at least one query ID and the data structure information of the query result, including: The distribution server obtains each serialized query content corresponding to the query result from the local disk and performs deserialization processing; According to the data structure information of the query result, multiple deserialized query contents are generated as query objects.
7. The method according to claim 6, characterized in that The distribution server generates XML files corresponding to the multiple target query requests according to the multiple query objects corresponding to the multiple target query requests, including: The distribution server assigns any query object to an external object, wherein the external object is provided with annotation information; The distribution server creates XML nodes for each query object and / or each external object to generate XML files corresponding to the multiple target query requests.
8. A method for generating an XML file, characterized in that: include: The distributed server receives multiple target query requests sent by the distribution server; The distributed server obtains query results of the target query requests from the target data source according to the multiple target query requests; The distributed server traverses the query results, determines the data structure information of the query results, and stores the query results to a local disk; The query result includes at least one query content; The data structure information is used to represent the affiliation between the query result and the at least one query content; The distributed server sends the query result to the cloud server; The distributed server receives the query ID sent by the cloud server; any query ID is generated by the cloud server based on any query content sent by the distributed server; The distributed server determines the query information according to the query ID of at least one query content in the query result and the data structure information of the query result, and sends the query information to the distribution server; The query information is used by the distribution server to obtain query content corresponding to at least one query ID from the cloud server, and generate an XML file according to the query content.
9. A device for generating an XML file, characterized in that: include: The sending unit is used to send multiple target query requests to the distributed server; Any target query request is used to obtain a query result including at least one query content; The query result is obtained by the distributed server from the target data source and stored in the local disk; The first processing unit is used for receiving query information sent by the distributed server for any target query request; The query information is obtained through the query result of the target query request; The query information includes a query ID of at least one query content in the query result and data structure information for the query result; any query ID is generated by the cloud server based on any query content sent by the distributed server; The data structure information for the query result is generated by the distributed server and is used to characterize the affiliation between the query result and the at least one query content; For any target query request, obtaining query content corresponding to the at least one query ID from the cloud server according to at least one query ID corresponding to the query result of the target query request; Generate a query object according to the query content corresponding to the at least one query ID and the data structure information of the query result; An XML file corresponding to the multiple target query requests is generated according to the multiple query objects corresponding to the multiple target query requests.
10. A device for generating an XML file, characterized in that: include: The acquiring unit is used to acquire the query result of the target query request from the target data source according to the multiple target query requests; Traversing the query results, determining the data structure information of the query results, and storing the query results to a local disk; The query result includes at least one query content; The data structure information is used to represent the affiliation between the query result and the at least one query content; The second processing unit is used to send the query result to the cloud server; Receiving a query ID sent by the cloud server; any query ID is generated by the cloud server based on any query content sent by the distributed server; Determine query information according to the query ID of at least one query content in the query result and the data structure information of the query result and send it to the distribution server; The query information is used by the distribution server to obtain query content corresponding to at least one query ID from the cloud server, and generate an XML file according to the query content.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and when the program is run on a computer, the computer is enabled to implement the method according to any one of claims 1 to 7.
12. A computing device, characterized in that: include: Memory for storing computer programs; A processor, configured to call a computer program stored in the memory, and execute the steps as claimed in any one of claims 1 to 7 according to the obtained program.
13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to claim 1 are implemented.
Citation Information
Patent Citations
System and method for data propagation tracking of application system
CN111966718A
Data query method and device, equipment and storage medium
CN113760986A
Data query method and device, equipment and storage medium
CN116028531A
Business processing method and device, equipment and storage medium
CN117235163A