Document parsing method and apparatus, electronic device, and storage medium

By parsing ARXML documents into an XML tree structure and parsing node information level by level, generating service signals and handling error information, the complexity, high error rate and poor fault tolerance of traditional ARXML document parsing methods are solved, achieving efficient and flexible document parsing and data processing.

WO2025213718A1PCT designated stage Publication Date: 2025-10-16CHINA FAW CO LTD

Patent Information

Application Number
PCT/CN2024/121173
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-09
Filing Date
2024-09-25
Publication Date
2025-10-16

AI Technical Summary

Technical Problem

Traditional ARXML document parsing methods are highly complex, have high error rates, poor fault tolerance, and are inflexible. They are difficult to process ARXML files of different structures and levels, affecting the efficiency and reliability of automotive software integration and optimization.

Method used

By parsing the ARXML document into a tree structure of XML document, obtaining the root node and parsing the node information level by level, generating service signals and sending subscription requests, obtaining processing results, and processing error information or status codes in a timely manner, the flexibility and fault tolerance of the system are improved.

Benefits of technology

It simplifies the workflow, reduces error rates, enhances the flexibility and scalability of the system, improves the stability and reliability of the terminal, and ensures the accuracy and integrity of the data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024121173_16102025_PF_FP_ABST
    Figure CN2024121173_16102025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of communications, and provide a document parsing method and apparatus, an electronic device, and a storage medium. The method comprises: reading the content of an ARXML document, and parsing the read content into the tree structure of an XML document; acquiring a root node of the tree structure, and taking the root node as a current node; extracting and parsing information of the current node; if the current node has a child node, taking the child node as the current node, and returning to the step of extracting and parsing the information of the current node; generating a service signal on the basis of the extracted and parsed information, and sending the service signal as a subscription request to a server; acquiring a processing result of the subscription request; and if the processing result is subscription failure, acquiring error information or a status code returned by the server. The embodiments of the present application can improve ARXML file parsing efficiency, fault tolerance and flexibility, reduce the error rate, and improve the subscription efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Document parsing method and device, electronic equipment and storage medium TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, in particular to a document parsing method and device, electronic equipment and storage medium. BACKGROUND

[0002] With the continuous development of the automotive industry, higher requirements are put forward for the integration and optimization of software and hardware. AUTOSAR and ARXML file as an important tool to achieve these goals are being more widely used, but the traditional ARXML document parsing has the following problems:

[0003] High complexity: the traditional document parsing method needs a lot of manual operation or needs to write a lot of custom code when parsing ARXML file and extracting information, resulting in large workload and complexity.

[0004] High error rate: ARXML file usually contains a large amount of configuration information and software architecture description, using the traditional document parsing method to manually process ARXML file is very time-consuming and prone to errors.

[0005] Poor fault tolerance: the traditional document parsing method lacks processing of abnormal situations, such as failure to capture error information or status code in time when subscribing request fails, resulting in system unable to respond to problems in time.

[0006] Not flexible: the traditional document parsing method is difficult to handle ARXML files of different structures and levels, lacking flexibility and scalability.

[0007] SUMMARY

[0008] The main purpose of the embodiments of the present application is to provide a document parsing method and device, electronic equipment and storage medium, which aims to improve the efficiency, fault tolerance and flexibility of parsing ARXML file, reduce the error rate and improve the efficiency of subscription.

[0009] To achieve the above purpose, one aspect of the embodiments of the present application provides a document parsing method, which comprises:

[0010] reading the content of ARXML document and parsing the read content into a tree structure of XML document;

[0011] obtaining the root node of the tree structure and taking the root node as the current node;

[0012] extracting and parsing the information of the current node;

[0013] if the current node has a child node, taking the child node as the current node and returning to the step of extracting and parsing the information of the current node.

[0014] generating a service signal according to the extracted and parsed information, and sending the service signal as a subscription request to a server, the service signal including a data type, a method identifier, and a group identifier;

[0015] obtaining a processing result of the subscription request;

[0016] if the processing result is a subscription failure, obtaining error information or a status code returned by the server.

[0017] In some embodiments, if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing information of the current node is returned, including:

[0018] if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing information of the current node is returned until the current node has no child node.

[0019] In some embodiments, the method further includes:

[0020] if the processing result is a subscription success, obtaining registered service information returned by the server.

[0021] In some embodiments, the method further includes:

[0022] converting the extracted node information into a target data structure, the target data structure including a list, a dictionary, and an object.

[0023] In some embodiments, the method further includes:

[0024] storing information of the current node.

[0025] In some embodiments, the obtaining of the processing result of the subscription request includes:

[0026] listening to a response of the server to obtain a processing result of the subscription request returned by the server.

[0027] In some embodiments, the reading of the ARXML file content and the parsing of the read content into a tree structure of an XML document include:

[0028] reading the ARXML file content by parsing a library and parsing the read content into a tree structure of an XML document.

[0029] In some embodiments, the error information returned by the server includes an error type, and the method further includes:

[0030] determining an error handling mode according to the error type.

[0031] In some embodiments, the error information returned by the server includes a status code, and the method further comprises:

[0032] determining an error type according to the status code;

[0033] determining an error processing mode according to the error type.

[0034] To achieve the above object, another aspect of the embodiments of the present application provides a document parsing device, which comprises:

[0035] a reading module configured to read the content of an ARXML document and parse the read content into a tree structure of an XML document;

[0036] a root node obtaining module configured to obtain a root node of the tree structure and take the root node as a current node;

[0037] a current node parsing module configured to extract and parse the information of the current node;

[0038] a traversal module configured to, if the current node has a child node, take the child node as the current node and return to the step of extracting and parsing the information of the current node;

[0039] a subscribing module configured to generate a service signal according to the extracted and parsed information and send the service signal as a subscription request to a server, the service signal comprising a data type, a method identifier and a group identifier;

[0040] a processing result obtaining module configured to obtain the processing result of the subscription request;

[0041] a returned information obtaining module configured to, if the processing result is a subscription failure, obtain error information or a status code returned by the server.

[0042] To achieve the above object, another aspect of the embodiments of the present application provides an electronic device, which comprises a memory and a processor, the memory storing a computer program, and the processor implementing the above method when executing the computer program.

[0043] To achieve the above object, another aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the above method when executed by a processor.

[0044] To achieve the above object, another aspect of the embodiments of the present application further provides a computer program product, which comprises a computer program, and the computer program implements the above method when executed by a processor.

[0045] The embodiments of the present application at least have the following beneficial effects: The present application provides a document parsing method and device, electronic equipment and storage medium, the scheme simplifies the work flow, reduces the work difficulty and workload by reading the content of the ARXML document and parsing the read content into the tree structure of the XML document; the root node of the tree structure is obtained, and the root node is taken as the current node; the information of the current node is extracted and parsed to ensure the accuracy and completeness of the extracted data, which helps to generate correct service signals and reduce error rate; if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing the information of the current node is returned, which is beneficial to flexibly process ARXML files with different structures and levels, and enhances the flexibility and expansibility of the system; the service signal is generated according to the extracted and parsed information, and the service signal is sent to the server as a subscription request; the processing result of the subscription request is obtained; if the processing result is a subscription failure, the error information or status code returned by the server is obtained to help the terminal respond to problems in time and take corresponding measures, thereby improving the fault tolerance, stability and reliability of the terminal. BRIEF DESCRIPTION OF DRAWINGS

[0046] FIG. 1 is a flowchart of a document parsing method provided by the embodiments of the present application;

[0047] FIG. 2 is a flowchart of step S106 in FIG. 1;

[0048] FIG. 3 is a flowchart of step S107 in FIG. 1;

[0049] FIG. 4 is a flowchart of step S107 in FIG. 1;

[0050] FIG. 5 is a schematic diagram of client-server communication provided by the embodiments of the present application;

[0051] FIG. 6 is a schematic diagram of a client process provided by the embodiments of the present application;

[0052] FIG. 7 is a schematic diagram of an SD server provided by the embodiments of the present application;

[0053] FIG. 8 is a schematic diagram of a status code returned by the server provided by the embodiments of the present application;

[0054] FIG. 9 is a schematic diagram of the structure of a document parsing device provided by the embodiments of the present application;

[0055] FIG. 10 is a schematic diagram of the hardware structure of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0056] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed explanations will be given below in combination with the accompanying drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and should not be used to limit the present application. When the following description refers to the accompanying drawings, the same numbers in different drawings represent the same or similar elements unless otherwise specified. The implementations described in the following exemplary examples do not represent all implementations consistent with embodiments of the present application. They are merely examples of apparatuses and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0057] It can be understood that the terms “first”, “second” and the like used in the present application can be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiments of the present application, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information. Depending on the context, the word “if” as used herein can be interpreted as “when” or “when” or “in response to determining”.

[0058] The terms “at least one”, “multiple”, “each”, “any” and the like used in the present application include one, two or more than two, multiple includes two or more than two, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as understood by a person skilled in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0060] Before the embodiments of the present application are described in detail, first, some nouns and terms involved in the embodiments of the present application are explained, and the nouns and terms involved in the embodiments of the present application are applicable to the following explanations.

[0061] 1) Service discovery server (SD server), refers to the process of automatically discovering available network services in a network. The service discovery server is a server responsible for managing and providing service discovery functions. The service discovery server usually stores information of available services in the network, such as the location of the service, IP address, port number, etc.

[0062] 2) ARXML Document (AUTOSAR XML) is an XML format used in the Automotive Open System Architecture (AUTOSAR) framework. ARXML is a data format used by AUTOSAR to describe and exchange information about software components and system configurations for automotive systems.

[0063] 3) Software Component Execution Unit (SWC Runnable) refers to a task unit that can be independently executed within an AUTOSAR Software Component (SWC). SWC is a basic building block in the AUTOSAR architecture, representing a software module with specific functionality. Each SWC can contain one or more runnables.

[0064] 4) Method Identifier (Method ID) is used in the AUTOSAR (Automotive Open System Architecture) framework to identify services within a SWC (Software Component).

[0065] 5) Group Identifier (GROUP ID) is used to group related SWCs together to form a logical software group. Software groups represent specific functions or subsystems in automotive systems, such as engine control units, chassis control units, etc.

[0066] 6) Automotive Open System Architecture (AUTOSAR) is an open, standardized automotive software architecture developed by the automotive industry and suppliers. It aims to provide a modular, scalable and reusable solution for automotive software development. The AUTOSAR architecture aims to support the complexity of automotive electronics and software systems while improving development efficiency, reducing costs, and ensuring system reliability and safety.

[0067] With the continuous development of the automotive industry, the integration and optimization of software and hardware become increasingly important. Automotive manufacturers and suppliers must ensure the high reliability, safety and performance of automotive software. To achieve these goals, AUTOSAR (Automotive Open System Architecture) and ARXML (AUTOSAR XML) files have become key tools. AUTOSAR provides a set of specifications for developing, testing and deploying automotive software, while ARXML files are used to describe and manage automotive software components and system configurations. However, traditional ARXML document parsing methods have some problems that limit their efficiency and effectiveness in practical applications.

[0068] Firstly, traditional ARXML document parsing methods are complex. Parsing ARXML files and extracting relevant information usually requires a lot of manual operations or a large amount of custom code. This method leads to a large amount of work and complexity, requiring professional knowledge and a deep understanding of the AUTOSAR architecture. In addition, since ARXML files contain rich configuration information and software architecture descriptions, manually identifying or parsing ARXML files is very time-consuming and prone to errors.

[0069] Secondly, the error rate is high. In the traditional document parsing process, due to human operation errors or understanding errors, configuration errors or inaccurate information extraction may occur. These errors may cause abnormal behavior of the automotive system, and even may cause safety problems.

[0070] In addition, the traditional document parsing method has poor fault tolerance. In actual application, various abnormal situations may be encountered, such as subscription request failure, communication interruption, etc. The traditional parsing method often lacks processing of these abnormal situations, and cannot capture error information or status codes in time. This may cause the system to be unable to respond to problems in time, affecting the performance and safety of the automobile.

[0071] Finally, the traditional document parsing method is not flexible and difficult to handle ARXML files of different structures and levels. With the increasing complexity of automotive software, the structure and level of ARXML files also become more and more complex. The traditional parsing method often lacks flexibility and scalability, and is difficult to meet the changing needs of automotive software.

[0072] In summary, although ARXML files play an important role in the integration and optimization of automotive software, traditional ARXML document parsing methods have some problems.

[0073] Therefore, the application provides a document parsing method and device, equipment and medium. The method comprises the following steps: reading the content of an ARXML document, parsing the read content into a tree structure of an XML document, simplifying the work flow, reducing the work difficulty and reducing the workload; obtaining a root node of the tree structure, taking the root node as a current node; extracting and parsing the information of the current node, ensuring the accuracy and completeness of the extracted data, helping to generate a correct service signal and reducing the error rate; if the current node has a child node, taking the child node as the current node and returning to the step of extracting and parsing the information of the current node, which is beneficial to flexibly processing ARXML files with different structures and levels and enhancing the flexibility and expansibility of the system; generating a service signal according to the extracted and parsed information and sending the service signal to a server as a subscription request; obtaining the processing result of the subscription request; if the processing result is a subscription failure, obtaining the error information or status code returned by the server, helping the terminal to respond to problems in time and take corresponding measures, and improving the fault tolerance, stability and reliability of the terminal.

[0074] The document parsing method provided in the application is related to the technical field of communication. The document parsing method provided in the application can be applied to a terminal, can also be applied to a server, and can be software running in the terminal or the server. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal and the like, but is not limited thereto; the server can be configured as a stand-alone physical server, can also be configured as a server cluster or a distributed system composed of multiple physical servers, can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN and big data and artificial intelligence platform, and the server can also be a node server in a blockchain network; the software can be an application for implementing the document parsing method, but is not limited to the above forms. In addition, the terminal and the server can adopt a C / S architecture, the terminal is a client, and the server is a server. Those skilled in the art can understand that the client and the server can run on one device or at least two devices.

[0075] The application is operable in a variety of general purpose or special purpose computer systems environments. Examples of well-known computer systems, environments, or configurations that can be suitable for use with the application include, but are not limited to, personal computers, server computers, handheld or laptop devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like, that perform particular tasks or implement particular abstract data types. The application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including memory storage devices.

[0076] FIG. 1 is an optional flowchart of a document parsing method according to an embodiment of the application. The method in FIG. 1 can include, but is not limited to, steps S101 to S107.

[0077] In step S101, the content of the ARXML document is read, and the read content is parsed into a tree structure of the XML document.

[0078] The application does not make specific limitations on the way of reading the content of the ARXML document, and can be flexibly selected according to actual parsing needs. For example, an XML parsing library can be used to complete the reading, or other tools can be used to complete the reading. In step S101 of some embodiments, the ElementTree library in Python can be used to read the content of the ARXML document. The content of the ARXML document can also be read through the BeautifulSoup library, without being limited thereto.

[0079] In this embodiment, the content of the ARXML document is read, and the read content is parsed into a tree structure of the XML document, so as to convert the content of the ARXML file into a tree structure which is easy to process and operate, thereby providing basic data for subsequent steps.

[0080] In step S102, the root node of the tree structure is obtained, and the root node is taken as a current node.

[0081] In some embodiments, the root node is obtained from the parsed tree structure, and is set as the current node, so as to extract and parse information from the root node.

[0082] In this embodiment, the root node of the tree structure is obtained, and the root node is taken as the current node, thereby ensuring that the information is processed from the top of the ARXML file, and providing a starting point for subsequent steps.

[0083] Step S103, information of the current node is extracted and parsed.

[0084] Specifically, the information of the current node includes a tag, an attribute, and text content. The attribute information of the current node includes a data type, a SWC runnable, a port, a type mapping, a signal node, a communication ID, a method identifier, and a group identifier.

[0085] In some embodiments, the information contained in the current node is extracted and parsed.

[0086] Optionally, the extraction and parsing can be, but are not limited to, extracting information such as a data type, a method identifier, a group identifier, and a period related to Ethernet communication.

[0087] It can be understood that the extracted information of the current node can be stored.

[0088] The storage structure of the information of the current node is not specifically limited in the present application, and can be flexibly selected in combination with actual parsing needs. Exemplarily, the information of the current node can be stored as a key-value pair, or as an object.

[0089] In the present embodiment, the information of the current node is extracted and parsed, which prepares for generating a service signal.

[0090] Step S104, if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing the information of the current node is returned.

[0091] In some embodiments, if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing the information of the current node is returned, until the current node has no child node.

[0092] In the present embodiment, if the current node has a child node, the child node is taken as the current node, and the step of extracting and parsing the information of the current node is returned, which ensures the step-by-step traversal of the entire ARXML document, thereby completely extracting all required information.

[0093] Step S105, a service signal is generated according to the extracted and parsed information, and the service signal is sent to the server as a subscription request.

[0094] Specifically, the service signal includes a data type, a method identifier, and a group identifier.

[0095] In some embodiments, the data type, the method identifier, and the group identifier are obtained from the node information, a service signal is generated, and the service signal is sent to the server as a subscription request.

[0096] The server is not specifically limited, and can be selected flexibly according to actual analysis needs. For example, an SD server or a cloud server can be used.

[0097] Optionally, the period, the data type, the method identifier, and the group identifier are obtained from the node information, a service signal is generated, and the service signal is sent to the server as a subscription request. The period is used to accurately specify a time interval of data transmission in the subscription request.

[0098] In this embodiment, the service signal is generated according to the extracted and parsed information, and the service signal is sent to the server as a subscription request, which can improve the timeliness and accuracy of data, and enables the server to register the service, so that the service can be discovered, subscribed, and used by other nodes in the network.

[0099] In step S106, a processing result of the subscription request is obtained.

[0100] Specifically, the processing result includes subscription failure or subscription success.

[0101] In some embodiments, the processing result of the subscription request can be obtained by waiting for a response of the server, or can be obtained by polling the processing result, and is not limited thereto.

[0102] In this embodiment, the processing result of the subscription request is obtained, which prepares for subsequent error processing.

[0103] In step S107, if the processing result is subscription failure, error information or a status code returned by the server is obtained.

[0104] In some embodiments, if the processing result of the subscription request is failure, the terminal obtains error information or a status code returned by the server, so as to perform error processing.

[0105] Optionally, the status code can be used to determine an error type, so as to determine an error processing manner, or can be used to determine an error position, so as to determine the error processing manner.

[0106] In this embodiment, if the processing result is subscription failure, error information or a status code returned by the server is obtained, which is helpful to identify and solve problems occurring in the subscription process in a timely manner, and improves stability and reliability.

[0107] The steps S101 to S107 shown in the embodiments of the present application simplify the workflow, reduce the work difficulty, and reduce the workload by reading the content of the ARXML document, parsing the read content into a tree structure of the XML document; obtaining a root node of the tree structure, taking the root node as a current node; extracting and parsing information of the current node to ensure the accuracy and completeness of the extracted data, which helps to generate a correct service signal and reduce the error rate; if the current node has a child node, taking the child node as the current node and returning to the step of extracting and parsing the information of the current node, which is beneficial to flexibly processing ARXML files of different structures and levels and enhancing the flexibility and expansibility of the system; generating a service signal according to the extracted and parsed information and sending the service signal as a subscription request to a server; obtaining a processing result of the subscription request; if the processing result is a subscription failure, obtaining error information or a state code returned by the server to help the terminal respond to problems in time and take corresponding measures, thereby improving the fault tolerance, stability, and reliability of the terminal.

[0108] Referring to FIG. 2, in some embodiments, the step S106 can include but is not limited to steps S201 to S202.

[0109] In step S201, a response of a server is listened to, and a processing result of a subscription request returned by the server is obtained.

[0110] In step S201 of some embodiments, a terminal obtains a processing result of a subscription request returned by a server by listening to a response of the server.

[0111] In the present embodiment, a response of a server is listened to, and a processing result of a subscription request returned by the server is obtained, which prepares for subsequent processing of subscription success and subscription failure.

[0112] In step S202, if the processing result is a subscription success, registered service information returned by the server is obtained.

[0113] Specifically, the registered service information includes all registered service information of the server. The registered service information indicates that these services have been registered in the network and can be discovered, subscribed, and used by other nodes. The registered service information includes a data type, a method identifier, and a group identifier.

[0114] In step S202 of some embodiments, if the processing result is a subscription success, registered service information returned by the server is obtained, and it is verified whether the registered service information contains a subscription request sent by the terminal. If yes, the service has been subscribed, and if no, the subscription request is updated according to the method identifier and the group identifier.

[0115] In the embodiment, if the processing result is that the subscription succeeds, the terminal can discover available services according to the server by obtaining the registered service information returned by the server, so as to realize dynamic service discovery.

[0116] Referring to FIG. 3, in some embodiments, the server returns error information, and step S107 can include but is not limited to steps S301-S302:

[0117] In step S301, if the processing result is that the subscription fails, error information returned by the server is obtained.

[0118] In step S301 of some embodiments, the server returns error information.

[0119] In step S302, an error processing manner is determined according to an error type.

[0120] Specifically, the error information includes the error type.

[0121] In step S302 of some embodiments, the error type can include but is not limited to network connection error, service unavailable, authentication failure, parameter error, and timeout.

[0122] Optionally, according to the error type, the error processing manner is determined, and a corresponding error processing strategy is formulated.

[0123] In some embodiments, the corresponding error processing strategy is formulated, which is beneficial to reduce error repetition.

[0124] In the embodiment, the error processing manner is determined according to the error type, which is beneficial to error processing, improves program stability, enhances user experience, and reduces error repetition probability.

[0125] Referring to FIG. 4, in some embodiments, the server returns a status code, and step S107 can include but is not limited to steps S401-S403:

[0126] In step S401, if the processing result is that the subscription fails, a status code returned by the server is obtained.

[0127] In step S401 of some embodiments, the server returns the status code. Specifically, the status code does not include the error type.

[0128] In step S402, an error type is determined according to the status code.

[0129] In step S402 of some embodiments, the error type is determined according to the status code by referring to a configuration document.

[0130] It should be noted that the configuration document is pre-set by relevant personnel.

[0131] Step S403, determining the error handling mode according to the error type.

[0132] In step S403 of some embodiments, the error type can include but is not limited to network connection error, service unavailable, authentication failure, parameter error, server failure and request timeout.

[0133] In some embodiments, the document parsing method is applied to the client, the server adopts the server side, the client communicates with the server, and the client server communication schematic diagram is shown in FIG. 5, wherein 501 represents the client, and 502 represents the server. The client flow schematic diagram is shown in FIG. 6, and the method in FIG. 6 includes but is not limited to steps S601 to S611:

[0134] Step S601, reading the ARXML file content through the parsing library, and parsing the read content into a tree structure of XML document.

[0135] In step S601 of some embodiments, a Python library for parsing XML files is imported, for example, xml.etree.ElementTree; a function or method is created to perform the parsing and processing of ARXML files; and the file operation function of Python is used to open the ARXML file.

[0136] Further, the ARXML file content is read using the parsing library and parsed into a tree structure of XML document. Wherein, the parse() function or similar method can be used.

[0137] Step S602, obtaining the root node of the tree structure, and taking the root node as the current node.

[0138] In step S602 of some embodiments, the root node is obtained from the parsed XML document, which is the starting point of the XML tree structure.

[0139] Step S603, extracting and parsing the information of the current node, and storing the information of the current node.

[0140] In step S603 of some embodiments, the label, attribute and text content of each node are extracted, and the information is processed or stored as needed.

[0141] For each node, its attributes are parsed and stored as key-value pairs or other data structures for subsequent processing and analysis. The attributes of ARXML contain a lot of information, such as data type, SWC runnable, port, type mapping, signal node, communication ID, method identifier (Method ID) and group identifier (GROUP ID) and other information. In this embodiment, the signal, ID, period and other information related to Ethernet communication are extracted.

[0142] Step S604, if the current node has child nodes, the child nodes are taken as the current nodes, and the step of extracting and parsing the current nodes and storing the information of the current nodes is returned.

[0143] In step S604 of some embodiments, the nodes and child nodes of the XML tree are traversed in a loop or recursive manner.

[0144] Step S605, converting the extracted node information into a target data structure.

[0145] In step S605 of some embodiments, the extracted node information is organized into a target data structure, such as a list, a dictionary, an object, etc., according to the requirements of parsing and the data structure.

[0146] Step S606, generating a service signal according to the information extracted and parsed, and sending the service signal as a subscription request to the server.

[0147] Optionally, a data model is created according to the extracted node information.

[0148] In step S606 of some embodiments, a service signal is generated according to the information extracted and parsed, and the service signal is sent as a subscription request to the SD server (i.e., the server) to request subscription of a specific service. Exemplarily, a schematic diagram of the SD server is shown in FIG. 7, where "SWC" represents "Software Component" (software component), "BSWM" represents "Basic Software Module" (basic software module), SD represents the SD server, and "SOAD" represents "Service-Oriented Architecture Design" (service-oriented architecture design).

[0149] Exemplarily, the service signal is shown in Table 1 below:

[0150] Table 1

[0151] Step S607, listening to the response of the server and obtaining the processing result of the subscription request returned by the server.

[0152] In step S607 of some embodiments, the response of the SD server (i.e., the server) is listened to, and the processing result of the subscription request is obtained.

[0153] Step S608, determining whether the processing result is a subscription failure.

[0154] Step S609, if the processing result is a subscription failure, obtaining the error information or status code returned by the server.

[0155] Exemplarily, a state code returned by the server is shown in FIG. 8. Among them, trigger failure is the processing result of subscription failure, and Sf_HMI_ObjectInfo and Sf_HMI_Obstacle are state codes.

[0156] In step S610, the error processing mode is determined according to the error type.

[0157] In step S610 of some embodiments, the possible errors and abnormal situations are processed to ensure the robustness and stability of the code.

[0158] In step S611, if the processing result is subscription success, the registered service information returned by the server is obtained.

[0159] Optionally, if the registered service information does not contain the service signal in the subscription request, the corresponding service parameters in the data model are retrieved, and the unmatched items are corrected. Among them, the service parameters in the data model include data type, Method ID and GROUP ID.

[0160] In step S611 of some embodiments, if the subscription is successful, the SD server will return the subscription result, including the registered service information. Among them, the service information includes data type, Method ID and GROUP ID.

[0161] It can be understood that the registered service information includes all the registered service information of the SD server. The registered service information indicates that these services have been registered in the network and can be discovered, subscribed and used by other nodes.

[0162] Further, after the parsing is completed, the opened ARXML file is closed and the resources are released.

[0163] Referring to FIG. 9, the embodiment of the application further provides a document parsing device, which can realize the above-mentioned document parsing method. The device comprises:

[0164] The reading module 901 is configured to read the content of the ARXML document and parse the read content into a tree structure of the XML document.

[0165] The root node obtaining module 902 is configured to obtain a root node of the tree structure and take the root node as a current node.

[0166] The current node parsing module 903 is configured to extract and parse the information of the current node.

[0167] The traversal module 904 is configured to take a child node of the current node as the current node and return to the step of extracting and parsing the information of the current node if the current node has the child node.

[0168] The subscription module 905 is configured to generate a service signal according to the extracted and parsed information, and send the service signal as a subscription request to a server, wherein the service signal comprises a data type, a method identifier and a group identifier.

[0169] The processing result acquisition module 906 is configured to acquire a processing result of the subscription request.

[0170] The return information acquisition module 907 is configured to acquire error information or a status code returned by the server if the processing result is a subscription failure.

[0171] It can be understood that the content in the above method embodiments is applicable to the device embodiments, the device embodiments specifically implement the functions of the above method embodiments, and achieve the same beneficial effects as the above method embodiments.

[0172] The electronic device provided in the embodiment of the present application includes a memory and a processor, the memory stores a computer program, and the processor implements the above document parsing method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer, etc.

[0173] It can be understood that the content in the above method embodiments is applicable to the device embodiments, the device embodiments specifically implement the functions of the above method embodiments, and achieve the same beneficial effects as the above method embodiments.

[0174] Please refer to FIG. 10, which shows the hardware structure of the electronic device of another embodiment, and the electronic device includes:

[0175] The processor 1001 can be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present application.

[0176] The memory 1002 can be implemented in the form of a ROM (ReadOnly Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory 1002 can store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 1002 and called and executed by the processor 1001 to implement the document parsing method in the embodiments of the present application.

[0177] The input / output interface 1003 is configured to realize information input and output.

[0178] The communication interface 1004 is configured to realize communication interaction between the device and other devices, and the communication can be realized through a wired manner (for example, a USB, a network cable, and the like) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, and the like).

[0179] The bus 1005 is configured to transmit information between various components (for example, the processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004) of the device.

[0180] The processor 1001, the memory 1002, the input / output interface 1003, and the communication interface 1004 are connected to each other through the bus 1005 to realize communication connection between the device.

[0181] The memory is a non-transitory computer readable storage medium, and can be used to store a non-transitory software program and a non-transitory computer executable program. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, for example, at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, and the remote memory can be connected to the processor through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0182] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to realize the above-mentioned document analysis method.

[0183] It can be understood that the contents in the above-mentioned method embodiments are all applicable to the present storage medium embodiment, the present storage medium embodiment specifically realizes the same functions as the above-mentioned method embodiments, and achieves the same beneficial effects as the above-mentioned method embodiments.

[0184] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0185] The document analysis method, the document analysis device, the electronic equipment and the storage medium provided by the embodiments of the present application simplify the work flow, reduce the work difficulty and the workload by reading the content of an ARXML document and analyzing the read content into a tree structure of an XML document; the root node of the tree structure is obtained and taken as a current node; the information of the current node is extracted and analyzed to ensure the accuracy and completeness of the extracted data, which helps to generate a correct service signal and reduce the error rate; if the current node has a child node, the child node is taken as the current node, and the step of extracting and analyzing the information of the current node is returned, which is beneficial to flexibly processing ARXML files of different structures and levels and enhancing the flexibility and expansibility of the system; a service signal is generated according to the extracted and analyzed information, and the service signal is sent to a server as a subscription request; a processing result of the subscription request is obtained; if the processing result is a subscription failure, error information or a state code returned by the server is obtained, which helps the terminal to respond to problems in time and take corresponding measures, and improves the fault tolerance, stability and reliability of the terminal.

[0186] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0187] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures, or combine certain steps or different steps.

[0188] The device embodiments described above are only schematic, and the units illustrated as separate components can or can not be physically separate, that is, can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0189] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.

[0190] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or chronological mundane operation, reverse order operation, based on circuitry availability, based on stated preference or the like, and that "default" or other orderings are thus permissible. Further, the terms "comprise", "comprising", "include", "including", and the like, are specifically intended to be open-ended. That is, references to individual steps and the like do not suhstantially exclude the presence of two or more of a recited step or its integral sub-steps or additional steps whether or not readily ascertainable from the description or the like. Further, the words "a" or "an", as used herein in the disclosure and elsewhere, are used indiscriminately and are to be interpreted in the same way, i.e. as meaning "one or more".

[0191] It should be understood that, in the application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0192] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0193] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0194] In addition, each of the functional units in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0195] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially, or parts contributing to the prior art, or all or a part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions used to cause a computer device (such as a personal computer, a server, or a network device) to execute all or part of the steps of the methods in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and any other medium that can store programs.

[0196] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not intended to limit the scope of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application. Each of the technical features of the above embodiments can be combined arbitrarily, and in order to make the description brief, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combinations of the technical features do not contradict, they shall be considered as the scope described in the specification.

[0197] The above-described embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these are within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A document parsing method, characterized in that: The method is applied to a terminal, and includes: Read the contents of the ARXML document and parse the read contents into the tree structure of the XML document; Obtaining the root node of the tree structure, and setting the root node as the current node; Extracting and parsing information of the current node; If the current node has a child node, use the child node as the current node and return to the step of extracting and parsing the information of the current node; Generate a service signal based on the extracted and parsed information, and send the service signal as a subscription request to the server, wherein the service signal includes a data type, a method identifier, and a group identifier; Obtaining a processing result of the subscription request; If the processing result is that the subscription fails, obtain the error information or status code returned by the server.

2. The method according to claim 1, characterized in that If the current node has a child node, taking the child node as the current node and returning to extract and parse the information of the current node includes: If the current node has a child node, the child node is used as the current node, and the process returns to the step of extracting and parsing the information of the current node until the current node has no child node.

3. The method according to claim 1, characterized in that The method further comprises: If the processing result is that the subscription is successful, the registered service information returned by the server is obtained.

4. The method according to claim 1, wherein The method further comprises: The extracted information is converted into target data structures, which include lists, dictionaries, and objects.

5. The method according to claim 1, wherein The method further comprises: The information of the current node is stored.

6. The method according to claim 1, characterized in that The obtaining of the processing result of the subscription request includes: Listen to the server's response to obtain the processing result of the subscription request returned by the server.

7. The method according to claim 1, characterized in that The reading of the ARXML file content and parsing the read content into a tree structure of an XML document includes: The ARXML file content is read through the parsing library and parsed into a tree structure of XML document.

8. The method according to any one of claims 1 to 7, characterized in that The error information returned by the server includes an error type, and the method further includes: An error handling method is determined according to the error type.

9. The method according to any one of claims 1 to 7, characterized in that The error information returned by the server includes a status code, and the method further includes: Determine the error type according to the status code; An error handling method is determined according to the error type.

10. A document parsing device, characterized in that: The device comprises: The reading module is used to read the contents of the ARXML document and parse the read contents into the tree structure of the XML document; A root node acquisition module, configured to acquire the root node of the tree structure and use the root node as the current node; A current node parsing module, used to extract and parse the information of the current node; A traversal module, configured to, if the current node has a child node, use the child node as the current node and return to the step of extracting and parsing the information of the current node; a subscription module, configured to generate a service signal based on the extracted and parsed information, and send the service signal as a subscription request to a server, wherein the service signal includes a data type, a method identifier, and a group identifier; A processing result acquisition module, used to obtain the processing result of the subscription request; The return information acquisition module is used to obtain the error information or status code returned by the server if the processing result is a subscription failure.

11. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 9 when executing the computer program.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • XML (extensible markup language) message processing method and XML message processing device

    CN102622444A

  • Distributed file transmission service method

    CN104243610A

  • Analysis method and analysis device for XML (extensible markup language) data

    CN106293862A

  • Interface document management method and device, server and storage medium

    CN109445841A

  • Document analysis method and device, electronic equipment and storage medium

    CN118333037A

Cited By

  • Document processing method and related equipment

    CN121501756A