Network communication method and system based on XML database

By implementing technical means such as data request parsing, XML format conversion, metadata addition and data item importance evaluation in the XML database system, the existing XML database system is solved when processing large-scale XML data flows and multi-coding standard data flows. Flexibility and efficiency issues significantly improve the system's processing efficiency and data security.

CN119416247AInactive Publication Date: 2025-02-11WUXI XINFENG IOT INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202411231207.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2025-02-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing XML database systems are difficult to realize real-time data parsing, conversion and storage when processing large-scale XML data streams, and lack flexibility when processing multi-encoding standard data streams, and poor metadata management, resulting in difficult to ensure data integrity and consistency. , data access permission control is inflexible.

Method used

Provides a network communication method based on XML database, by collecting and parsing data requests, converting them into XML format and supporting multiple encoding standards, adding metadata and merging them into the original data, evaluating the importance of data items to determine processing priorities, and Dynamically adjust data access permissions based on user permissions.

Benefits of technology

It significantly improves the system's processing efficiency, data integrity and security, enhances the system's flexibility and compatibility, and can handle large-scale XML data streams more efficiently and adapt to multi-coding standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416247A_ABST
    Figure CN119416247A_ABST
Patent Text Reader

Abstract

The invention discloses a network communication method and system based on an XML database, and relates to the technical field of data processing and information.The method comprises the steps that data requests from an external system are collected, the received data requests are analyzed, and key information of the data requests is extracted; the received data is converted into an XML format, multiple coding standards are supported, and a data stream is formed; adding metadata to the data stream, adding the metadata into the data stream, merging the metadata with the original data, and generating a final XML effective load; identifying each data item in the XML data, evaluating the importance of each data item, determining the priority of data processing, and storing a processing result in a database; and for a processing result in the database, a requester permission is set, a permission level is calculated, and finally the access permission of the data is determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing and information technology, in particular to a network communication method and system based on XML database. Background Art

[0002] With the rapid development of Internet technology, the demand for data exchange and sharing is growing. XML (Extensible Markup Language), as an open standard, has been widely used in the field of data exchange due to its good structural characteristics and easy understanding and processing. XML can not only represent complex data structures, but also embed metadata to enhance the semantic information of data. Therefore, XML-based data exchange and management methods have become one of the key technologies in modern information systems. In recent years, with the rise of cloud computing and big data technologies, the application of XML in cloud environments has become increasingly important. Especially in distributed systems, how to effectively manage and process XML data streams has become a research hotspot.

[0003] Traditional XML processing technologies mainly rely on file systems or relational databases to store and retrieve XML documents. However, these methods often face performance bottlenecks when processing large-scale data sets. In order to overcome these limitations, XML databases came into being. XML databases are a database management system specifically used to store and retrieve XML documents. They support XML-specific data structures and query languages ​​(such as XPath and XQuery) and can process XML data more efficiently. In recent years, XML database technology has made significant progress, supporting higher levels of concurrency control, indexing technology, and query optimization strategies, greatly improving data processing capabilities.

[0004] Although XML database technology has made certain progress, there are still some challenges in practical applications. First, for large-scale XML data stream processing, existing XML database systems often find it difficult to achieve real-time data parsing, conversion and storage. Especially when data requests are frequent and the amount of data is huge, the real-time processing capability of data is particularly important. Secondly, existing XML database systems lack flexibility in processing data streams with multiple encoding standards, which limits the scope of application of the system. Thirdly, for metadata management in XML data, existing technologies often do not fully consider the effective integration of metadata and original data, resulting in difficulty in ensuring data integrity and consistency. Finally, in the process of data processing, how to automatically adjust the processing priority according to the importance of data items, and how to dynamically adjust data access rights according to user permissions are common problems in existing technologies. Summary of the invention

[0005] In view of the above existing problems, the present invention is proposed.

[0006] Therefore, the present invention provides a network communication method based on XML database to solve the problems of low XML data processing efficiency, poor metadata management and inflexible data access authority control in the prior art.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0008] In a first aspect, an embodiment of the present invention provides a network communication method based on an XML database, which comprises:

[0009] Collect data requests from external systems, parse the received data requests, and extract key information of the data requests; convert the received data into XML format and support multiple encoding standards to form a data stream; add metadata to the data stream, attach the metadata to the data stream and merge it with the original data to generate the final XML payload; identify each data item in the XML data, evaluate the importance of each data item, determine the priority of data processing, and store the processing results in the database; set the requester's permissions and calculate the permission level for the processing results in the database, and ultimately determine the access rights to the data.

[0010] As a preferred solution of the XML database-based network communication method of the present invention, wherein:

[0011] The collecting of data requests from external systems, parsing of received data requests, and extraction of key information of data requests include the following steps:

[0012] The system receives data requests from external systems by listening to preset ports and URLs;

[0013] Verify the legitimacy of the received data request and check whether the data request conforms to the predefined format;

[0014] Parse data requests to extract key information, including request type, requested resource path, and request parameters;

[0015] Extract request parameters from the data request, the part starting with a question mark in the URL, use the delimiter to split the query string into multiple key-value pairs, and split each key-value pair into a key and a value;

[0016] According to the parsing results, the parameters in the data request and their corresponding values ​​are extracted.

[0017] As a preferred solution of the XML database-based network communication method of the present invention, wherein:

[0018] The method of converting the received data into XML format and supporting multiple encoding standards to form a data stream includes the following steps:

[0019] According to the key information in the data request, determine the data type of each field and the data structure that needs to be converted to XML format. Based on the data structure, determine the XML Schema definition;

[0020] Determine the encoding standards that need to be supported based on data requests and business needs, and convert the generated XML documents to the required encoding standards;

[0021] The encoding conversion function is used to calculate the encoding quality after the data is converted to the encoding standard. The expression is:

[0022]

[0023] Among them, E(d, s) represents the encoding quality of element s in the original data d, d is the original data, s is an element in the encoding standard set, c s For compatibility with encoding standard s, e s is the efficiency of the coding standard s, g s For the universality of coding standards;

[0024] The coding standards are sorted according to the coding quality, and the coding standard with the highest coding quality is selected as the best choice and used as the coding standard of the data stream;

[0025] According to the selected coding standard, the XML document is converted and whether the converted XML document complies with the selected coding standard is verified;

[0026] Select a suitable data stream transmission method according to business needs, create appropriate data stream objects for the selected transmission method, define the format of the data packet, encapsulate the contents of the XML document into the data packet, and send the encapsulated data packet to the destination through the data stream.

[0027] As a preferred solution of the XML database-based network communication method of the present invention, wherein:

[0028] The step of adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate a final XML payload includes the following steps:

[0029] Analyze data requests, identify metadata information and metadata types that need to be added, and determine necessary metadata types based on business needs and data requests;

[0030] According to the determined metadata type, a corresponding XML element structure is defined, and a metadata element in the XML document is created;

[0031] Get the fill value of each metadata element and fill it;

[0032] Determine the merge position of the metadata element in the XML document, and merge the metadata element into the XML document;

[0033] Use the XML Schema validation tool to verify whether the merged XML document conforms to the defined XML Schema. If the validation fails, correct the errors in the XML document and revalidate until it succeeds.

[0034] Convert the validated XML document into a payload and save it.

[0035] As a preferred solution of the XML database-based network communication method of the present invention, the method of identifying each data item in the XML data, evaluating the importance of each data item, determining the priority of data processing, and storing the processing results in the database includes the following steps:

[0036] Use XML parser to parse XML documents;

[0037] Identify each data item according to the structure of the XML document and extract the value of each data item from the XML document;

[0038] Define the data items to be extracted according to the structure of the XML document and assign a unique identifier and label to each data item;

[0039] Traverse the structure of the XML document, access each data item, and extract specific values ​​from each data item;

[0040] Define the indicator for evaluating the importance of data items according to business requirements. The expression is:

[0041]

[0042] Where V(d) is the importance score of data item d, d is an element in the data item set, fd is the usage frequency of data item d, i d is the influence of data item d on subsequent processing, u d is the uniqueness of data item d, are the importance coefficients of frequency of use, degree of influence, and uniqueness, respectively;

[0043] The formula for calculating the degree of impact is:

[0044]

[0045] Among them, i d is the influence degree of data item d, P is the set of influencing factors, w pis the weight of each influencing factor p, p d is the performance score of data item d on influencing factor p, and D is the set of all data items;

[0046] The formula for calculating uniqueness is,

[0047]

[0048] Among them, u d is the uniqueness of data item d, D is the set of all data items, and sim(d, d′) is the similarity score between data item d and data item d′;

[0049] Sort the data items based on the importance scores, assign a priority to each data item based on the sorting results, and define the rules for data processing based on the priority levels, thereby determining the order of data processing;

[0050] Determine the database type to be used based on business requirements, configure the parameters required for database connection, create a database connection object based on the configured parameters, and test the connection to ensure successful connection to the database;

[0051] Define the table structure in the database based on the processing results, define the fields and their data types for the table, and use SQL statements and database APIs to perform insert operations.

[0052] As a preferred solution of the XML database-based network communication method of the present invention, wherein: the processing results in the database, setting the requester's authority, calculating the authority level, and finally determining the access rights of the data include the following steps:

[0053] Determine the permission type based on business requirements and define the permission level for each permission type. Define the required permission types based on business requirements and define the permission level for each permission type;

[0054] Define the value range of the requester's role level and the meaning and functional restrictions of each role level, and define the value range of the requester's attributes and the meaning and functional impact of each attribute;

[0055] Calculate the requester's permission score, the expression is,

[0056]

[0057] Where P(r,a) is the requester's permission score, r is an element in the requester set, a is the requester's attribute set, α is the weight factor of the role level, β is the offset of the role level, r is the requester's role level, and a is the i is the i-th attribute of the requester, λ iis the weight factor of the i-th attribute, n is the number of attributes, γ is the exponential factor of the role level, R max is the maximum value of the character level;

[0058] Define corresponding access rules for each permission level, determine the permission level of the requester according to the permission score of the requester, find the corresponding access rules according to the permission level of the requester, and match the permission level of the requester with the defined access rules;

[0059] The specific access rights of the requester to the data are determined based on the matching results, and the access rights of the requester are recorded.

[0060] In a second aspect, the present invention provides a network communication system based on XML database, comprising:

[0061] The data receiving module is responsible for collecting data requests from external systems;

[0062] The data parsing module is responsible for parsing the received data requests and extracting the key information of the data requests;

[0063] The data conversion module is responsible for converting the received data into XML format and supports multiple encoding standards to form a data stream;

[0064] The metadata adding module is responsible for adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate the final XML payload;

[0065] The data priority assessment module is responsible for identifying each data item in the XML data, assessing the importance of each data item, and determining the priority of data processing;

[0066] Data processing and storage module, responsible for processing data and storing it in the database;

[0067] The permission management module is responsible for setting the requester's permissions, calculating the permission level, and ultimately determining the access rights to the data based on the processing results in the database.

[0068] In a third aspect, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the network communication method based on XML database as described in the first aspect of the present invention is implemented.

[0069] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the network communication method based on XML database as described in the first aspect of the present invention.

[0070] The beneficial effects of the present invention are: through efficient data request processing, flexible data encoding conversion, effective integration of metadata, priority management of data processing and intelligent control of data access rights, the system processing efficiency, data integrity and security are significantly improved, while the system flexibility and compatibility are also enhanced. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0072] Figure 1 This is a flow chart of the network communication method based on XML database in Example 1. DETAILED DESCRIPTION

[0073] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.

[0074] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0075] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0076] Example 1, reference Figure 1 , which is the first embodiment of the present invention, and provides a network communication method based on XML database, comprising the following steps:

[0077] S1. Collect data requests from external systems, parse the received data requests, and extract key information of the data requests, including the following steps:

[0078] The system receives data requests from external systems by listening to preset ports and URLs. These requests can be HTTP GET or POST requests, or messages from other protocols such as WebSocket or MQTT.

[0079] Verify the legitimacy of the received data request, including verifying whether the request carries valid authentication information (such as an OAuth token or API key). For example, verification can be performed by checking whether there is a valid authentication token in the Authorization field in the request header;

[0080] Check whether the data request conforms to the predefined format, for example, check whether the XML data request follows the correct XML Schema definition (XSD);

[0081] Parse the data request to extract key information, including the request type, the requested resource path, and the request parameters. The request type indicates the request method type, such as GET or POST, the requested resource path indicates the requested target resource path, such as / data / query, and the request parameters indicate the parameters carried in the request, such as the query string or specific tags or attributes in the XML data.

[0082] Determine the request type based on the header information of the received data request. For example, if it is an HTTP request, the request type can be obtained from the Method field of the request header, such as GET or POST. Extract the resource path from the data request. The resource path is usually located in the request URL, immediately following the host name.

[0083] Extract request parameters from the data request. For GET requests, request parameters are usually located in the query string of the URL. Extract the query string from the URL. The query string is the part of the URL that starts with a question mark. Use delimiters to split the query string into multiple key-value pairs, and split each key-value pair into a key and a value. For POST requests, request parameters are usually located in the data request. Use a DOM or SAX parser to parse XML data. This step involves converting the XML document into a DOM tree or triggering a sequence of events for subsequent processing. Based on the parsing results, extract the parameters in the request body and their corresponding values. These parameters can be specific tags and attributes in the XML data.

[0084] Traverse the DOM tree or event sequence, find specific XML tags, and if the parameters are stored in the attributes of the XML tags, extract the values ​​of these attributes;

[0085] According to the parsing results, the parameters in the data request and their corresponding values ​​are extracted.

[0086] S2, convert the received data into XML format and support multiple encoding standards to form a data stream;

[0087] Furthermore, according to the key information in the data request, such as device ID, status type and status value, determine the data type of each field, such as string, integer and date and time, and determine the data structure that needs to be converted into XML format. For example, if the request contains device status data, the data structure should contain information about device ID, status type and status value; based on the data structure, determine the XML Schema definition to ensure the correctness and consistency of the XML document format;

[0088] Determine the encoding standards that need to be supported based on data requests and business needs, and convert the generated XML documents to the required encoding standards;

[0089] The encoding conversion function is used to calculate the encoding quality after the data is converted to the encoding standard. The expression is:

[0090]

[0091] Among them, E(d, s) represents the encoding quality of element s in the original data d, d is the original data, s is an element in the encoding standard set, c s is the compatibility of the coding standard s, indicating the compatibility of the coding standard with different platforms and software, e s is the efficiency of the coding standard s, representing the efficiency of the coding standard in data compression and transmission, g s The universality of the encoding standard s, which indicates the universality of the encoding standard in different languages ​​and character sets;

[0092] The value range of E(d, s) is (0, 1]. The closer the value is to 0, the lower the quality of the coding standard s is. The closer the value is to 1, the higher the quality of the coding standard s is. Specifically, when c s Larger, e s Larger and g s When it is larger, the value of E(d, s) will also be closer to 1, indicating that the quality of coding standard s in data request processing is higher;

[0093] The coding standards are sorted according to the coding quality, and the coding standard with the highest coding quality is selected as the best choice and used as the coding standard of the data stream;

[0094] Convert XML documents according to the selected coding standard and verify whether the converted XML documents comply with the selected coding standard to ensure the integrity and correctness of the data;

[0095] Select a suitable data stream transmission method according to business needs, create appropriate data stream objects for the selected transmission method, define the format of the data packet, encapsulate the contents of the XML document into the data packet, and send the encapsulated data packet to the destination through the data stream.

[0096] S3, adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate the final XML payload, including the following steps:

[0097] Analyze the data request and identify the metadata information and metadata types that need to be added, such as timestamp, source, and data type. Determine the necessary metadata types based on business needs and data requests. For example, if the data request needs to record the creation time of the data, you need to add a <timestamp> element. Define the corresponding XML element structure for each metadata type. For example, define the format of the <timestamp> element as YYYY-MM-DDTHH:MM:SS.

[0098] According to the determined metadata type, a corresponding XML element structure is defined, and a metadata element in the XML document is created;

[0099] Get the fill value of each metadata element and fill it;

[0100] Determine the merge position of the metadata element in the XML document, merge the metadata element into the XML document, and ensure consistency with the original data structure;

[0101] Use the XML Schema validation tool to verify whether the merged XML document conforms to the defined XML Schema. If the validation fails, correct the errors in the XML document and revalidate until it succeeds.

[0102] Convert the validated XML document into a payload and save it.

[0103] S4, identifying each data item in the XML data, evaluating the importance of each data item, determining the priority of data processing, and storing the processing results in a database, including the following steps:

[0104] Use XML parser to parse XML documents;

[0105] Identify each data item according to the structure of the XML document and extract the value of each data item from the XML document;

[0106] Analyze XML Schema to understand the structure of XML documents, parse the structural definitions in XML Schema, including elements and attributes, identify key elements in XML documents based on business requirements, define a data item for each key element, determine the specific information to be extracted, and assign a unique identifier and label to each data item;

[0107] Traverse the structure of the XML document, access each data item, locate the specific XML element and attribute according to the data item identifier, obtain the relevant information of the data item, such as the element name and attribute name, and extract the specific value of the XML element and attribute from each data item;

[0108] Define the indicator for evaluating the importance of data items according to business requirements. The expression is:

[0109]

[0110] Where I(d) is the importance score of data item d, d is an element in the data item set, fd is the usage frequency of data item d, and i d is the influence of data item d on subsequent processing, u d is the uniqueness of data item d, They are the importance coefficients of usage frequency, impact degree and uniqueness. The usage frequency fd can be obtained by querying logs or database statistics, and the importance coefficient Can be set according to business needs;

[0111] The value range of I(d) is [0, +∞). The closer the value is to 0, the lower the importance of the data item is, and the larger the value is, the higher the importance of the data item is. Specifically, when f d Larger, d Larger and u d When is larger, the value of I(d) will also be larger, indicating that data item d is more important in data request processing;

[0112] The formula for calculating the degree of impact is:

[0113]

[0114] Among them, i d is the influence degree of data item d, P is the set of influencing factors, w p is the weight of each influencing factor p, p d is the performance score of data item d on influencing factor p, D is the set of all data items, and the weighted average performance score of each data item on all influencing factors is calculated and normalized to the maximum score to obtain i d ;

[0115] The formula for calculating uniqueness is,

[0116]

[0117] Among them, u dis the uniqueness of data item d, D is the set of all data items, sim(d, d′) is the similarity score between data item d and data item d′, which can be calculated using cosine similarity and other similarity measurement methods;

[0118] The formula for calculating the similarity score sim(d, d′) is,

[0119]

[0120] Among them, sim(d, d′) is the similarity score between data item d and data item d′, θ(d, d′) is the angle between the two data item vectors, and are the eigenvectors of data items d and d′, respectively. and They are and The modulus length, here the cosine similarity is used as the similarity measurement method;

[0121] First, determine the set D containing all data items, remove the data item d currently being calculated for uniqueness from D, and obtain a new set D′=D-{d}. For each d′∈D′, calculate the similarity score sim(d, d′) between d and d′, sum the sim(d, d′) of all d′∈D′, and calculate the uniqueness u based on the total similarity score obtained. d ;

[0122] u d The value range of is [0, 1]. The closer the value is to 0, the higher the uniqueness of the data item d is. The closer the value is to 1, the lower the uniqueness of the data item d is. Specifically, when the value of sim(d, d′) is smaller, u d The value of will also be closer to 0, indicating that the data item d is more unique than other data items;

[0123] Sort the data items based on the importance scores, assign a priority to each data item based on the sorting results, and define the rules for data processing based on the priority levels, thereby determining the order of data processing;

[0124] Determine the database type to be used based on business requirements, such as relational databases (such as MySQL, PostgreSQL) and non-relational databases (such as MongoDB), configure the parameters required for database connection, such as host address, port, user name, and password, create a database connection object based on the configured parameters, and test the connection to ensure successful connection to the database;

[0125] Define the table structure in the database based on the processing results, define the fields and their data types for the table, and use SQL statements and database APIs to perform insert operations.

[0126] S5. For the processing results in the database, set the requester's permissions, calculate the permission level, and finally determine the access rights to the data, including the following steps:

[0127] Determine the permission types based on business needs, such as read, write, and delete, and define permission levels for each permission type, such as administrator, advanced user, and ordinary user. Define the required permission types based on business needs, such as read permission, write permission, and delete permission, and define permission levels for each permission type, such as administrator permission, advanced user permission, and ordinary user permission;

[0128] Define the value range of the requester's role level and the meaning and functional restrictions of each role level, and define the value range of the requester's attributes and the meaning and functional impact of each attribute;

[0129] Calculate the requester's permission score, the expression is,

[0130]

[0131] Where P(r, a) is the permission score of the requester, which indicates the permission level of the requester r under a given attribute set a. r is an element in the requester set, a is the attribute set of the requester, α is the weight factor of the role level, which indicates the importance of the role level in calculating the permission level, β is the offset of the role level, which is used to adjust the starting value of the role level to avoid too small a permission level when the role level is low, r is the role level of the requester, which indicates the role level of the requester in the system, usually a positive integer. The higher the level, the greater the permission, and a i is the i-th attribute of the requester, which represents the attribute values ​​of the requester. Each attribute can be a continuous value or a discrete value. i is the weight factor of the i-th attribute, indicating the requester attribute a i The importance of calculating the permission level. n is the number of attributes, which means the total number of attributes owned by the requester. γ is the exponential factor of the role level, which is used to adjust the influence of the role level on the permission level calculation. R max It is the maximum value of the character level, used to standardize the contribution of the character level;

[0132] The value range of P(r, a) is [1, 100], which means that the permission level of the requester r is a real number between 1 and 100. The closer the value is to 1, the lower the permission level of the requester is, and the closer the value is to 100, the higher the permission level of the requester is. Specifically, when r is large and When it is smaller, the value of P(r, a) will also be closer to 100, indicating that the requester r has a higher level of authority in data access control;

[0133] Define corresponding access rules for each permission level, determine the permission level of the requester according to the permission score of the requester, such as administrator, advanced user and ordinary user, find the corresponding access rules according to the permission level of the requester, and match the permission level of the requester with the defined access rules;

[0134] Determine the specific access rights of the requester to the data based on the matching results, and record the access rights of the requester;

[0135] Administrators have full access to all data, including read, write, and delete, and can modify the permission settings of other users. Advanced users can write data under certain conditions and can read most data. Ordinary users can only access specific data sets and specific types of records and cannot perform any write or delete operations.

[0136] This embodiment also provides a network communication system based on XML database, including:

[0137] The data receiving module is responsible for collecting data requests from external systems; the data parsing module is responsible for parsing the received data requests and extracting the key information of the data requests; the data conversion module is responsible for converting the received data into XML format and supporting multiple encoding standards to form a data stream; the metadata adding module is responsible for adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate the final XML effective load; the data priority evaluation module is responsible for identifying each data item in the XML data, evaluating the importance of each data item, and determining the priority of data processing; the data processing and storage module is responsible for processing data and storing it in the database; the permission management module is responsible for setting the requester's permissions, calculating the permission level, and ultimately determining the access rights to the data based on the processing results in the database.

[0138] This embodiment also provides a computer device, which is suitable for the network communication method based on XML database, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the network communication method based on XML database proposed in the above embodiment.

[0139] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0140] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the network communication method based on the XML database proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination of them, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0141] In summary, the present invention can quickly and accurately identify legal and valid data requests by: monitoring the preset port and URL to receive data requests, and verifying the legitimacy, format checking and extracting key information, thereby ensuring the accuracy of subsequent processing, reducing the situation where invalid requests occupy system resources, and improving the overall processing efficiency and security of the system; determining the XML based on the key information in the data request Schema definition, and selection of the optimal encoding standard, using the selected encoding standard to convert XML documents into data streams, so that the system can adapt to the needs of various encoding standards, enhance the system's cross-platform transmission and data processing capabilities, and reduce data parsing errors caused by inconsistent encoding; define metadata types according to business needs, create XML element structures, fill in metadata values, and merge them into XML documents, which enhances the traceability and understandability of data and helps to better use data for decision-making; identify data items through the XML parser, calculate the importance score of each data item, and determine the processing priority based on these scores, so that the system can automatically adjust the processing logic according to the importance of the data items, improving the efficiency and response speed of data processing; define permission types and levels according to business needs, calculate the permission level of the requester, and determine data access rights based on the permission level of the requester, which enhances the security of the system, protects sensitive data from unauthorized access, and simplifies the workload of administrators.

[0142] Example 2, referring to Table 1, is the second example of the present invention. To further verify the advancement of the present invention, experimental simulation data of a network communication method based on an XML database is provided.

[0143] In order to verify the beneficial effects of the present invention and compare it with the prior art, the following experiment was conducted. In the experiment, a network communication method based on XML database was simulated, which realized the whole process from data request processing to data access permission setting. The experimental environment includes a simulated server side, which receives the data request sent by the client, processes the data request according to the method of the present invention, generates XML payload, and finally determines the access permission of the data.

[0144] The experimental preparation contents are as follows:

[0145] Hardware configuration: Intel Core i7-9700K CPU@3.60GHz, 16GB RAM, Windows Server 2019.

[0146] Software environment: Apache Tomcat 9.0.51, MySQL 8.0.28, Java 11, Python 3.9.12.

[0147] Testing tools: JMeter 5.4.1, Postman 8.14.0, XMLSpy 2022.

[0148] Test data: 100 data requests were simulated, each containing different parameters and data types.

[0149] The experimental steps are as follows:

[0150] Collect data requests from external systems: The simulation server listens to port 8080 and receives data requests from clients.

[0151] Parse data request: Use Java's HttpURLConnection class to receive HTTP requests, and use Java's URLEncoder and URLDecoder classes to parse request parameters.

[0152] Data conversion into XML format: Use Java's DOM parser to convert data into XML format and use Xerces library to validate the format of XML document.

[0153] Adding metadata: Use Python's lxml library to create metadata elements and merge them into the XML document.

[0154] Evaluate the importance of data items: Use Python to evaluate the importance of data items and determine the priority of data processing based on the evaluation results.

[0155] Storing processing results: Use MySQL database to store processing results.

[0156] Set requester permissions: Use Python scripts to calculate the requester's permission level and determine access rights based on the permission level.

[0157] Experimental details

[0158] Collect data requests: Receive data requests from external systems by listening to the preset port 8080. The simulation server received 100 data requests, each of which contained a different combination of parameters.

[0159] Parse data request: Verify the legitimacy of the received data request and check whether the data request conforms to the predefined format. Use Java's URLEncoder and URLDecoder classes to parse the query string in the URL and extract the request parameters.

[0160] Data conversion to XML format: According to the key information in the data request, determine the data type of each field and the data structure that needs to be converted to XML format. Use the DOM parser to convert data to XML format and support multiple encoding standards such as UTF-8, UTF-16 and ISO-8859-1.

[0161] Add metadata: Analyze the data request, identify the metadata information that needs to be added, such as timestamp, source, etc., and create the corresponding XML elements. Merge these metadata into the XML document, and then use the XML Schema validation tool to verify the validity of the document.

[0162] Evaluate the importance of data items: Define indicators for evaluating the importance of data items, including frequency of use, impact on subsequent processing, and uniqueness of data items. Use Python scripts to calculate the importance score of each data item and sort the data items according to the score.

[0163] Storing processing results: Determine the database type (MySQL) to be used based on business requirements. Configure database connection parameters and create a database connection object. Define the table structure in the database based on the processing results and use SQL statements to perform insert operations.

[0164] Set requester permissions: Define permission types, including read, write, and delete permissions, and define permission levels. Define the role level and attributes of the requester, and calculate the requester's permission level. Determine data access permissions based on permission levels.

[0165] Table 1 XML communication method processing time statistics

[0166]

[0167] In order to more intuitively demonstrate the beneficial effects of the present invention, we compare the method of the present invention with the traditional JSON-based data processing method. The following is a comparative analysis of the processing time of the two methods:

[0168] Conversion time: In the present invention, the average conversion time is 0.05 seconds, while the average conversion time of the traditional JSON processing method is about 0.08 seconds. The present invention takes advantage of the high efficiency of the DOM parser and the support of multiple encoding standards to make data conversion faster.

[0169] Metadata adding time: In the present invention, the average metadata adding time is 0.025 seconds, while the average metadata adding time of the traditional JSON processing method is about 0.05 seconds. The present invention improves the speed of metadata adding by defining a specific XML element structure and using Python's lxml library.

[0170] Data item evaluation time: In the present invention, the average data item evaluation time is 0.03 seconds, while the average data item evaluation time of the traditional JSON processing method is about 0.06 seconds. The present invention optimizes the data processing flow and reduces unnecessary processing time by evaluating the importance of data items and determining the priority of data processing.

[0171] Permission setting time: In the present invention, the average permission setting time is 0.015 seconds, while the average permission setting time of the traditional JSON processing method is about 0.04 seconds. The present invention simplifies the permission setting process and improves efficiency by calculating the permission level of the requester and determining the access rights according to the permission level.

[0172] In summary, the XML database-based network communication method of the present invention is more efficient in data conversion, metadata addition, data item evaluation, and permission setting than the traditional JSON-based data processing method. This improvement is mainly due to the following points:

[0173] Efficient DOM parser: The DOM parser can parse XML documents quickly, improving the speed of data conversion.

[0174] Support for multiple encoding standards: Support for multiple encoding standards enables data to be seamlessly transferred between different systems, reducing problems caused by inconsistent encoding.

[0175] Efficient addition of metadata: By defining a specific XML element structure and using Python's lxml library, the speed of adding metadata is improved.

[0176] Importance assessment of data items: By assessing the importance of data items and determining the priority of data processing, the data processing process is optimized and unnecessary processing time is reduced.

[0177] Calculation of permission levels: By calculating the permission level of the requester and determining access rights based on the permission level, the permission setting process is simplified and efficiency is improved.

[0178] From the above analysis, it can be seen that the present invention has obvious innovation and advantages in processing network communication data, especially in terms of processing efficiency, which is significantly better than the traditional JSON-based data processing method.

[0179] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A network communication method based on XML database, characterized in that: include, Collect data requests from external systems, parse the received data requests, and extract key information of the data requests; Convert the received data into XML format and support multiple encoding standards to form a data stream; Add metadata to the data stream, append the metadata to the data stream and merge it with the original data to generate the final XML payload; Identify each data item in the XML data, evaluate the importance of each data item, determine the priority of data processing, and store the processing results in the database; For the processing results in the database, set the requester permissions, calculate the permission level, and ultimately determine the access rights to the data.

2. The network communication method based on XML database as claimed in claim 1, characterized in that: The collecting of data requests from external systems, parsing of received data requests, and extraction of key information of data requests include the following steps: The system receives data requests from external systems by listening to preset ports and URLs; Verify the legitimacy of the received data request and check whether the data request conforms to the predefined format; Parse data requests to extract key information, including request type, requested resource path, and request parameters; Extract request parameters from the data request, the part starting with a question mark in the URL, use the delimiter to split the query string into multiple key-value pairs, and split each key-value pair into a key and a value; According to the parsing results, the parameters in the data request and their corresponding values ​​are extracted.

3. The network communication method based on XML database as claimed in claim 2, characterized in that: The method of converting the received data into XML format and supporting multiple encoding standards to form a data stream includes the following steps: According to the key information in the data request, determine the data type of each field and the data structure that needs to be converted to XML format. Based on the data structure, determine the XML Schema definition; Determine the encoding standards that need to be supported based on data requests and business needs, and convert the generated XML documents to the required encoding standards; The encoding conversion function is used to calculate the encoding quality after the data is converted to the encoding standard. The expression is: Among them, E(d,s) represents the encoding quality of element s in the original data d, d is the original data, s is an element in the encoding standard set, c s For compatibility with encoding standard s, e s is the efficiency of the coding standard s, g s For the universality of coding standards; The coding standards are sorted according to the coding quality, and the coding standard with the highest coding quality is selected as the best choice and used as the coding standard of the data stream; According to the selected coding standard, the XML document is converted and whether the converted XML document complies with the selected coding standard is verified; Select a suitable data stream transmission method according to business needs, create appropriate data stream objects for the selected transmission method, define the format of the data packet, encapsulate the contents of the XML document into the data packet, and send the encapsulated data packet to the destination through the data stream.

4. The network communication method based on XML database as claimed in claim 3, characterized in that: The step of adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate a final XML payload includes the following steps: Analyze data requests, identify metadata information and metadata types that need to be added, and determine necessary metadata types based on business needs and data requests; According to the determined metadata type, a corresponding XML element structure is defined, and a metadata element in the XML document is created; Get the fill value of each metadata element and fill it; Determine the merge position of the metadata element in the XML document, and merge the metadata element into the XML document; Use the XML Schema validation tool to verify whether the merged XML document conforms to the defined XML Schema. If the validation fails, correct the errors in the XML document and revalidate until it succeeds. Convert the validated XML document into a payload and save it.

5. The network communication method based on XML database as claimed in claim 4, characterized in that: The method of identifying each data item in the XML data, evaluating the importance of each data item, determining the priority of data processing, and storing the processing results in a database includes the following steps: Use XML parser to parse XML documents; Identify each data item according to the structure of the XML document and extract the value of each data item from the XML document; Define the data items to be extracted according to the structure of the XML document and assign a unique identifier and label to each data item; Traverse the structure of the XML document, access each data item, and extract specific values ​​from each data item; Define the indicator for evaluating the importance of data items according to business requirements. The expression is: Where V(d) is the importance score of data item d, d is an element in the data item set, and f d is the usage frequency of data item d, i d is the influence of data item d on subsequent processing, u d is the uniqueness of data item d, They are the importance coefficients of frequency of use, degree of influence, and uniqueness; The formula for calculating the degree of impact is: Among them, i d is the influence degree of data item d, P is the set of influencing factors, w p is the weight of each influencing factor p, p d is the performance score of data item d on influencing factor p, and D is the set of all data items; The formula for calculating uniqueness is, Among them, u d is the uniqueness of data item d, D is the set of all data items, sim(d,d′) is the similarity score between data item d and data item d′, d ′ represents any other data item in the data item set D except the data item d; Sort the data items based on the importance scores, assign a priority to each data item based on the sorting results, and define the rules for data processing based on the priority levels, thereby determining the order of data processing; Determine the database type to be used based on business requirements, configure the parameters required for database connection, create a database connection object based on the configured parameters, and test the connection to ensure successful connection to the database; Define the table structure in the database based on the processing results, define the fields and their data types for the table, and use SQL statements and database APIs to perform insert operations.

6. The network communication method based on XML database as claimed in claim 5, characterized in that: The processing results in the database are used to set the requester's permissions, calculate the permission level, and finally determine the access rights to the data, including the following steps: Determine the permission type based on business requirements and define the permission level for each permission type. Define the required permission types based on business requirements and define the permission level for each permission type. Define the value range of the requester's role level and the meaning and functional restrictions of each role level, and define the value range of the requester's attributes and the meaning and functional impact of each attribute; Calculate the requester's permission score, the expression is, Where P(r,a) is the requester's permission score, r is an element in the requester set, a is the requester's attribute set, α is the weight factor of the role level, β is the offset of the role level, r is the requester's role level, and a is the i is the i-th attribute of the requester, λ i is the weight factor of the i-th attribute, n is the number of attributes, γ is the exponential factor of the role level, P max is the maximum value of the character level; Define corresponding access rules for each permission level, determine the permission level of the requester according to the permission score of the requester, find the corresponding access rules according to the permission level of the requester, and match the permission level of the requester with the defined access rules; The specific access rights of the requester to the data are determined based on the matching results, and the access rights of the requester are recorded.

7. A network communication system based on XML database, based on the network communication method based on XML database according to any one of claims 1 to 6, characterized in that: include, The data receiving module is responsible for collecting data requests from external systems; The data parsing module is responsible for parsing the received data requests and extracting the key information of the data requests; The data conversion module is responsible for converting the received data into XML format and supports multiple encoding standards to form a data stream; The metadata adding module is responsible for adding metadata to the data stream, attaching the metadata to the data stream and merging it with the original data to generate the final XML payload; The data priority assessment module is responsible for identifying each data item in the XML data, assessing the importance of each data item, and determining the priority of data processing; Data processing and storage module, responsible for processing data and storing it in the database; The permission management module is responsible for setting the requester's permissions, calculating the permission level, and ultimately determining the access rights to the data based on the processing results in the database.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the XML database-based network communication method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the network communication method based on XML database described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method and system for applying metadata to data sets of file objects

    CA2668306A1

  • Method and system for customizing and converting storage format of vector database

    CN117667932A

  • Data security capability detection method and system

    CN118427843A

Cited By

  • Terminal information processing system based on big data

    CN120498789A

  • A terminal information processing system based on big data

    CN120498789B

  • Smart city integrated management system and method based on multi-mode communication

    CN120562849A