CN112181539A - File processing method, device, equipment and medium - Google Patents

File processing method, device, equipment and medium Download PDF

Info

Publication number
CN112181539A
CN112181539A CN202011035738.3A CN202011035738A CN112181539A CN 112181539 A CN112181539 A CN 112181539A CN 202011035738 A CN202011035738 A CN 202011035738A CN 112181539 A CN112181539 A CN 112181539A
Authority
CN
China
Prior art keywords
node
program
signature
procedure
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011035738.3A
Other languages
Chinese (zh)
Other versions
CN112181539B (en
Inventor
刘均
舒海文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN202011035738.3A priority Critical patent/CN112181539B/en
Publication of CN112181539A publication Critical patent/CN112181539A/en
Application granted granted Critical
Publication of CN112181539B publication Critical patent/CN112181539B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The application is applicable to the technical field of computers, and provides a file processing method, which comprises the following steps: analyzing the file to be processed to obtain a node of the file to be processed; and responding to the fact that the node is a signature node, generating a code for realizing the step of selecting the program node according to a pre-constructed associated information set, and writing the generated code into the signature node to realize the execution of the program of the selected program node when the signature node is called, wherein the associated information in the associated information set is used for describing the association relationship between the signature node and the program node. According to the method and the device, the code for executing the step of selecting the program node is written into the signature node, so that the program of the selected program node can be automatically executed when the signature node is called. When the signature node is called, a program for specifically executing which program node does not need to be additionally set, so that the signature node can be conveniently called, and the efficiency of calling the signature node is improved.

Description

File processing method, device, equipment and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for processing a file.
Background
Open Test sequence eXchange (OTX) language is a high-level programming language applied to the field of automobile diagnosis, and its complete syntax semantics and program structure definition are mainly given by ISO13209 series standards. The ISO13209-1 standard mainly comprises general theory and use case of OTX; the ISO13209-2 standard includes primarily the core data model specifications and requirements of OTX; the ISO13209-3 standard mainly includes standard extensions and requirements of OTX.
In OTX, a Signature node (Signature) usually declares an interface, including the name of the declared interface, input/output parameters of the declared interface, and the like. The program node (Procedure) may be an implementation of Signature or may be a separate function. The difference between Signature and Procedure is that: signature has no implementer, and Procedure has an implementer, i.e., Procedure can execute the flow. A Signature may typically have multiple implementations, i.e., a Signature may have multiple corresponding procedures.
In the related art, if a Signature needs to be called, a Procedure corresponding to the Signature generally needs to be configured to call the Signature. This manner of invocation is inefficient. Therefore, in the related art, it is necessary to improve the efficiency of calling Signature.
Disclosure of Invention
The embodiment of the application provides a file processing method, a file processing device, file processing equipment and a file processing medium.
In a first aspect, an embodiment of the present application provides a file processing method, where the method includes:
analyzing the file to be processed to obtain a node of the file to be processed;
and responding to the fact that the node is a Signature, generating a code for realizing the step of selecting the program node according to a pre-constructed associated information set, and writing the generated code into the Signature so as to realize the execution of the selected program of the Procedure when the Signature is called, wherein the associated information in the associated information set is used for describing the association relationship between the Signature and the Procedure.
Further, the step of selecting program nodes includes:
selecting the associated information from the associated information set, and executing the validity judgment step: in response to determining that the effectiveness of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure;
and in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, and continuing to execute the validity judgment step.
Further, the effectiveness of the Procedure is positively related to the value of a preset parameter in the Procedure; and
in response to determining that the validity of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure, including:
and in response to the fact that the value of the preset parameter is larger than the preset value, determining that the effectiveness of the Procedure corresponding to the selected associated information is true, and selecting the corresponding Procedure.
Further, in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, includes:
and in response to the fact that the value of the preset parameter is smaller than or equal to the preset value, determining that the validity of the Procedure corresponding to the selected associated information is false, and selecting the unselected associated information from the associated information set.
Further, the associated information in the associated information set includes a name of Signature and attribute information associated with the name of Signature, and the attribute information includes a name of Procedure, a name of Signature, and a storage address of Procedure.
Further, the pre-constructed association information set is obtained by:
when the file to be processed is analyzed, nodes of the file to be processed are traversed, and when a current node is accessed, the following storage operations are executed: responding to the fact that the current node is a Procedure, storing the current node and obtaining attribute information of the current node; and in response to the fact that the acquired attribute information comprises the name of the Signature, storing the included name of the Signature and the attribute information of the current node into an associated information set in an associated mode.
Further, the storing operation further comprises: and responding to the current node being a node except the Procedure, and storing the current node.
In a second aspect, an embodiment of the present application provides a document processing apparatus, including:
the file analysis unit is used for analyzing the file to be processed to obtain a node of the file to be processed;
and the node processing unit is used for responding to the fact that the node is the Signature, generating a code for realizing the step of selecting the program node according to a pre-constructed association information set, and writing the generated code into the Signature to realize the execution of the selected Procedure program when the Signature is called, wherein the association information in the association information set is used for describing the association relationship between the Signature and the Procedure.
Further, in the node processing unit, the step of selecting a program node includes:
selecting the associated information from the associated information set, and executing the validity judgment step: in response to determining that the effectiveness of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure;
and in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, and continuing to execute the validity judgment step.
Further, in response to determining that the validity of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure includes:
and in response to the fact that the value of the preset parameter is larger than the preset value, determining that the effectiveness of the Procedure corresponding to the selected associated information is true, and selecting the corresponding Procedure.
Further, in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, includes:
and in response to the fact that the value of the preset parameter is smaller than or equal to the preset value, determining that the validity of the Procedure corresponding to the selected associated information is false, and selecting the unselected associated information from the associated information set.
Further, the associated information in the associated information set includes a name of Signature and attribute information associated with the name of Signature, and the attribute information includes a name of Procedure, a name of Signature, and a storage address of Procedure.
Further, the pre-constructed association information set is obtained by:
when the file to be processed is analyzed, nodes of the file to be processed are traversed, and when a current node is accessed, the following storage operations are executed: responding to the fact that the current node is a Procedure, storing the current node and obtaining attribute information of the current node; and in response to the fact that the acquired attribute information comprises the name of the Signature, storing the included name of the Signature and the attribute information of the current node into an associated information set in an associated mode.
Further, the storing operation further comprises: and responding to the current node being a node except the Procedure, and storing the current node.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the file processing method when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of the file processing method.
In a fifth aspect, an embodiment of the present application provides a computer program product, which, when run on an electronic device, causes the electronic device to execute the file processing method of any one of the above first aspects.
Compared with the related technology, the embodiment of the application has the beneficial effects that: by writing a code for executing the step of selecting the program node into Signature, it is possible to automatically execute the selected Procedure program when Signature is called. When the Signature is called, a program for specifically executing which Procedure does not need to be configured additionally, so that the Signature can be called conveniently and rapidly, and the efficiency of calling the Signature is improved.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram illustrating a document processing method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a procedure of selecting a program node according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a program node provided in an embodiment of the present application;
FIG. 4 is a schematic flow chart diagram illustrating a document processing method according to another embodiment of the present application;
FIG. 5 is a flowchart illustrating a file parsing step according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating steps implemented by code generated by the code generation step provided by an embodiment of the present application;
FIG. 7 is a schematic structural diagram of a document processing apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
In order to explain the technical means of the present application, the following examples are given below.
Referring to fig. 1, a schematic flowchart of a document processing method provided in an embodiment of the present application is shown, where the document processing method shown in fig. 1 includes:
step 101, analyzing a file to be processed to obtain a node of the file to be processed.
The file to be processed is usually an OTX file in eXtensible Markup Language (XML) format. The XML format is a plain text format, and each XML element may be referred to as a node. Each node typically includes a start tag (< title >), an end tag (</title >) and content between the two tags. In form, the markup may include comments, references, character data segments, start markup, end markup, null elements, document type declarations and prologs, etc. It should be noted that there may be one or more files to be processed. If there are multiple files to be processed, the multiple files to be processed may be analyzed, respectively, to obtain nodes of the multiple files to be processed.
In the present embodiment, the execution subject of the above-described document processing method may be various apparatuses, such as a vehicle diagnosis apparatus. It should be noted that the execution subject may also be a device such as a smart phone, a tablet computer, a laptop portable computer, a desktop computer, and the like.
Here, since the file to be processed is an OTX file in an XML format, the file in the XML format generally has a specific format, and the file in the XML format is composed of several nodes. Therefore, the execution main body can analyze the file to be processed by adopting a file analysis mode aiming at the XML format to obtain all nodes of the file to be processed.
And 102, responding to the fact that the node is a signature node, generating a code for realizing the step of selecting the program node according to a pre-constructed associated information set, and writing the generated code into the signature node so as to realize execution of the program of the selected program node when the signature node is called.
And the associated information in the associated information set is used for describing the association relationship between the Signature and the Procedure. In practice, each piece of association information in the association information set is used to describe an association relationship between one Signature and one Procedure. A Signature is typically associated with at least one Procedure.
The step of selecting a program node generally refers to a step of selecting a Procedure from at least one Procedure associated with Signature. As an example, the step of selecting a program node may include: randomly selecting a Procedure from at least one Procedure associated with the Signature.
In this embodiment, after all the nodes of the file to be processed are obtained through parsing, the execution body may further process the Signature therein. For each Signature, the execution body may generate a code for implementing the step of selecting the program node based on an association relationship between the Signature and the Procedure described in the association information set. The generated code is thus written into Signature to implement the execution of the chosen Procedure program when Signature is called.
According to the method provided by the embodiment of the application, the code for executing the step of selecting the program node is written into the Signature, so that the selected program of the Procedure can be automatically executed when the Signature is called. When the Signature is called, a program for specifically executing which Procedure does not need to be additionally set, so that the Signature can be conveniently called, and the efficiency of calling the Signature is improved.
In an optional implementation manner of each embodiment of the present application, the association information in the association information set generally includes a name of a Signature and attribute information associated with the name of the Signature, where the attribute information includes a name of a Procedure, a name of the Signature, and a storage address of the Procedure. It should be noted that the association information may also include other information of Signature, and may also include other information of Procedure associated with Signature. And is not particularly limited herein.
It is noted that the set of association information is typically implemented as a map container. The map container is a data structure for storing data in a key-value pair manner. Here, the name of Signature may be a key (or referred to as a key), and attribute information of Procedure may be a value (or referred to as a value). The map container can realize rapid and efficient data adding, deleting, modifying and checking, and has high data processing efficiency.
In some optional implementations of this embodiment, the step of selecting the program node may include steps 201 and 202.
Fig. 2 is a flowchart illustrating a procedure of selecting a program node according to an embodiment of the present application.
Step 201, selecting associated information from the associated information set, and executing validity judgment step: and selecting the corresponding program node in response to determining that the validity of the program node corresponding to the selected associated information is true.
Here, the executing entity may select a piece of associated information from the associated information set, and execute the following validity determining step: and if the effectiveness of the Procedure corresponding to the selected associated information is true, selecting the Procedure corresponding to the associated information. In practical applications, the attribute information of the Procedure usually includes an indication information for indicating the validity of the Procedure. The execution agent may analyze the attribute information of the Procedure to obtain the indication information, thereby determining whether the validity of the Procedure is true.
Fig. 3 is a schematic diagram of a program node according to an embodiment of the present application. As shown in FIG. 3, < Produce > in the first row is the starting marker of the Produce, and </Produce > in the last row is the ending marker of the Produce.
In line 2, name ═ getIgByDiagService "indicates that the name of the Procedure is getIgByDiagService. The "sig: getignationstate" indicates that the Procedure adopts a rule stated by a certain Signature, and the name of the Signature is sig: getignationstate. The term val: Workshop denotes the validity function of the Procedure with the name val: Workshop. The id of "6-p 1" indicates that the parent node of the Procedure has an id of 6-p 1.
In line 3, the specification node provides a piece of text that describes the program.
The realzation node is the mark of the implementation, and lines 4-16 are the implementation contents of the Procedure.
On line 5, the parameters node is a parameter set, and the parameters of the program in the Procedure are declared here.
On line 6, outParam is one of the parameters, and name is "state", indicating that the name of the parameter is state. The id of "6-d 1" indicates that the id of the parent node of the parameters node is 6-d 1.
On line 7, the specification node provides a piece of text that describes the program.
Lines 8-10, the realzation node is an implementation of a state parameter, where line 9 indicates that the type of the state parameter is Boolean type.
Lines 13-15, the flow node is a specific program implementation of the Procedure, with implementation omitted from the figure.
According to the content of FIG. 3, if the value of val, the Workshop function, is true, it indicates that the validity of the Procedure is true. Otherwise, if the value of val, namely the Workshop function, is false, the validity of the Procedure is false.
It should be noted that the value of the val: works hop function is usually dynamically changed, and the dynamically changed value of the val: works hop function may be stored in the association information set as the attribute information of the Procedure. Therefore, the method and the device can directly analyze the attribute information of the Procedure in the associated information and directly know whether the effectiveness of the Procedure is true or not. The data processing efficiency is extremely high.
Step 202, in response to determining that the validity of the program node corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, and continuing to execute the validity judgment step.
Here, if the validity of the Procedure corresponding to the associated information is false, the execution main body may continue to select another piece of unselected associated information from the associated information set, so as to execute the validity determination step for the new associated information. It should be noted that if a Procedure with a true validity is found, the above step of selecting the program node is ended. If the Procedure with the real effectiveness is not found all the time, the step of selecting the program node is finished after traversing the association information set.
In the implementation mode, the automatic selection of the Procedure with real effectiveness and the execution of the selected Procedure program can be realized when the Signature is called. The method and the device can realize convenient and fast call of the Signature, and are favorable for further improving the call efficiency of the Signature.
In some optional implementations of this embodiment, if the validity of the Procedure is positively related to the value of the preset parameter in the Procedure. Then, in step 201, in response to determining that the validity of the program node corresponding to the selected association information is true, selecting the corresponding program node includes: and in response to the fact that the value of the preset parameter is larger than the preset value, determining that the effectiveness of the Procedure corresponding to the selected associated information is true, and selecting the corresponding Procedure.
The preset parameter may be a parameter in the Procedure. The number of the preset parameters may be one or more. If the number of the preset parameters is multiple, the average value of the values of the multiple parameters can be used as the value of the preset parameter.
The preset value may be a preset data value. For example, the preset value may be 2.
The validity of the Procedure positively correlates to the value of the preset parameter in the Procedure, and generally means that the greater the value of the preset parameter is, the greater the probability that the validity of the Procedure is true is.
Here, if the value of the preset parameter is larger than the preset value, the validity of the Procedure is determined to be true. At this time, the Procedure is selected.
In the implementation mode, the effectiveness of the Procedure is determined by the value of the parameter in the Procedure, so that the implementation is convenient, and the improvement of the data processing efficiency is facilitated. Thereby contributing to further improving the efficiency of the call to Signature.
In the foregoing implementation manner, when the validity of the Procedure is positively related to the value of the preset parameter in the Procedure, in the step 202, in response to determining that the validity of the program node corresponding to the selected associated information is false, the selecting, from the associated information set, the unselected associated information includes:
and in response to the fact that the value of the preset parameter is smaller than or equal to the preset value, determining that the validity of the Procedure corresponding to the selected associated information is false, and selecting the unselected associated information from the associated information set.
Here, if the value of the preset parameter is less than or equal to the preset value, the validity of the Procedure is determined to be false. And reselecting unselected associated information from the associated information set for processing. And only the Procedure with the real effectiveness can be selected for execution.
In an optional implementation manner of each embodiment of the present application, the pre-constructed association information set is obtained as follows:
when the file to be processed is analyzed, nodes of the file to be processed are traversed, and when a current node is accessed, the following storage operations are executed: first, in response to the current node being a Procedure, the current node is stored and attribute information of the current node is acquired. And then, responding to the fact that the acquired attribute information comprises the name of the Signature, and storing the name of the Signature and the attribute information of the current node into an associated information set in an associated mode.
In this implementation manner, when the file to be processed is parsed, the execution main body may traverse to each node in the file to be processed. For each node in the file to be processed, the execution subject may execute a storage operation on the node. Specifically, if the node is a Procedure, the execution body may store the node and obtain the attribute information of the node. And then, analyzing whether the attribute information of the node comprises the name of the Signature or not, and if so, storing the name of the Signature and the attribute information of the node into an associated information set in an associated manner. In practice, the name of the Signature included is usually used as a key, the attribute information of the Procedure is used as a value, and the name of the Signature and the attribute information of the Procedure are stored in a map container in the form of a key-value pair.
It should be noted that the association information set is constructed when the file to be processed is parsed. Therefore, the file to be processed only needs to be analyzed once, the data processing efficiency is high, and the computing resource is saved.
In the foregoing implementation manner, the storing operation may further include: and responding to the current node being a node except the Procedure, and storing the current node.
Here, when traversing each node of the file to be processed, if the current node is not a Procedure, the execution body directly stores the current node and the attribute information of the current node to obtain the current node. It is noted that each node in an XML-formatted file typically has attribute information.
In this implementation manner, when traversing each node of the file to be processed, if the current node is the Procedure, the execution main body continues to determine whether the Procedure corresponds to the Signature. And if the Procedure does not correspond to the Signature, directly storing the Procedure. If the Procedure corresponds to the Signature, the name of the corresponding Signature and the attribute information of the Procedure are stored in the association information set in an association manner while the Procedure is stored. In addition, if the current node is not the Procedure, the current node is directly stored. The method and the device can realize that the file to be processed is analyzed once, and each node of the file to be processed and the associated information set are obtained. The method is beneficial to improving the data processing efficiency, thereby saving the computing resources.
With continuing reference to fig. 4, fig. 4 is a schematic flowchart of a file processing method according to an embodiment of the present application. The file processing method shown in fig. 4 includes: a file parsing step 401 and a code generation step 402.
It is to be noted that the execution subjects of the file parsing step 401 and the code generating step 402 may be various devices, such as a vehicle diagnostic device.
Fig. 5 is a flowchart illustrating a file parsing step according to an embodiment of the present application, where the file parsing step includes steps 501-506.
Step 501, judging whether an OTX file exists. If yes, step 502 is executed, otherwise, the file parsing step is exited.
Step 502, loading and parsing the OTX file.
Step 503, determine whether there is a Procedure, if yes, execute step 504, otherwise execute step 501.
Here, in the process of parsing the OTX source file, if the Procedure is parsed, the step 504 is continuously performed on the Procedure. Otherwise, step 501 is executed to implement parsing processing on the next OTX file.
Step 504, entering Procedure to obtain attribute information.
Here, since each node has attribute information therein. The execution agent may obtain the attribute information in the Procedure.
Step 505, determine whether the Procedure is associated with Signature.
Here, if the attribute information of the Procedure includes a name of a Signature, it is considered that the Procedure is related to the Signature. If the Procedure is associated with Signature, step 506 is executed, otherwise step 503 is executed to realize the judgment of other Procedure in the current OTX file.
Step 506, placing the Signature and the Procedure into a map container, wherein key is Signature, and value is attribute information of Procedure.
Here, the name of Signature and attribute information of Procedure are stored in a map container as a key-value pair. Wherein, key is the name of Signature, and value is the attribute information of Procedure. Here, the name of the associated Signature and the attribute information of the Procedure are associated information, and the map container is a specific implementation manner of the associated information set.
After step 506, step 503 is continued until the current OTX file is parsed.
Here, repeatedly executing step 503 may implement traversing the procedures in the OTX file, so as to obtain all procedures associated with Signature in the current OTX file. In addition, when all OTX files are analyzed, the associated information set can be obtained.
It should be noted that the execution subject of the steps 501 and 506 included in the file parsing step can be various devices, such as a vehicle diagnosis device.
Fig. 6 is a flowchart illustrating steps implemented by codes generated by the code generation step according to an embodiment of the present application. Wherein, the code generated by the code generation step can be implemented as the following step 601-604.
Step 601, circularly traversing the map container in the Signature function body.
Here, in the file parsing step, in the process of parsing the OTX file, each node of the OTX file may be generally parsed, so as to obtain each node of the OTX file.
For any one of the obtained signatures, the execution entity may write a function body for implementing the step of selecting the program node in the Signature. To enable traversal of the map container within the body of the Signature's function. And searching for a valid program node associated with the signature node when traversing the map container so as to realize the execution of the program of the selected program node when calling the signature node.
Step 602, determine whether the Signature has associated Procedure.
Here, since data is usually stored in the form of key-value pairs in the map container, and the keys of the data stored in the map container are: the name of Signature, the value corresponding to the key is: attribute information of the Procedure. Therefore, the attribute information of the Procedure associated with the Signature name can be found from the map container through the Signature name, so that the Procedure associated with the Signature is obtained.
Here, if the Signature is associated with a Procedure, the step 603 is executed, otherwise the code generation step is exited.
Step 603, determining whether the validity value of the Procedure associated with the Signature is true, if so, executing step 604. Otherwise, step 601 is executed, and traversal is continued on the map container until a valid Procedure associated with the Signature is found, or the map container is traversed.
Step 604, the function of the active Procedure associated with the Signature is executed. And when the function of the effective Procedure is executed, exiting the function body of the Signature.
It should be noted that the execution subject of the steps 601-604 can be various devices, such as a vehicle diagnosis device.
Referring further to fig. 7, corresponding to the document processing method of the foregoing embodiment, fig. 7 is a block diagram of a document processing apparatus 700 provided in the embodiment of the present application, and for convenience of description, only the relevant parts of the embodiment of the present application are shown.
Referring to fig. 7, the apparatus includes:
the file analysis unit 701 is used for analyzing the file to be processed to obtain a node of the file to be processed;
and the node processing unit 702 is configured to, in response to the node being a Signature, generate a code for implementing a step of selecting a program node according to a pre-constructed association information set, and write the generated code into the Signature to implement execution of a selected Procedure of the Procedure when the Signature is called, where association information in the association information set is used to describe an association relationship between the Signature and the Procedure.
In one embodiment, the step of selecting a program node in the node processing unit 702 includes:
selecting the associated information from the associated information set, and executing the validity judgment step: in response to determining that the effectiveness of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure;
and in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, and continuing to execute the validity judgment step.
In one embodiment, in response to determining that the validity of the Procedure corresponding to the selected associated information is true, selecting the corresponding Procedure includes:
and in response to the fact that the value of the preset parameter is larger than the preset value, determining that the effectiveness of the Procedure corresponding to the selected associated information is true, and selecting the corresponding Procedure.
In one embodiment, in response to determining that the validity of the Procedure corresponding to the selected associated information is false, selecting unselected associated information from the associated information set includes:
and in response to the fact that the value of the preset parameter is smaller than or equal to the preset value, determining that the validity of the Procedure corresponding to the selected associated information is false, and selecting the unselected associated information from the associated information set.
In one embodiment, the association information in the association information set includes a name of Signature and attribute information associated with the name of Signature, and the attribute information includes a name of Procedure, a name of Signature, and a storage address of Procedure.
In one embodiment, the pre-constructed association information set is obtained by:
when the file to be processed is analyzed, nodes of the file to be processed are traversed, and when a current node is accessed, the following storage operations are executed: responding to the fact that the current node is a Procedure, storing the current node and obtaining attribute information of the current node; and in response to the fact that the acquired attribute information comprises the name of the Signature, storing the included name of the Signature and the attribute information of the current node into an associated information set in an associated mode.
In one embodiment, the storing operation further comprises: and responding to the current node being a node except the Procedure, and storing the current node.
The apparatus according to this embodiment can realize automatic execution of the selected Procedure program when Signature is called by writing a code for executing a Procedure of selecting a program node into Signature. When the Signature is called, a program for specifically executing which Procedure does not need to be additionally set, so that the Signature can be conveniently called, and the efficiency of calling the Signature is improved.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Referring further to fig. 8, fig. 8 is a schematic structural diagram of an electronic device 800 according to an embodiment of the present application. As shown in fig. 8, the electronic apparatus 800 of this embodiment includes: at least one processor 801 (only one processor is shown in fig. 8), a memory 802, and a computer program 803, such as a file processing program, stored in the memory 802 and operable on the at least one processor 801. The steps in any of the various method embodiments described above are implemented when the computer program 803 is executed by the processor 801. The steps in the embodiments of the respective file processing methods described above are implemented when the processor 801 executes the computer program 803. The processor 801, when executing the computer program 803, implements the functions of the various modules/units in the various device embodiments described above, such as the functions of the units 701-702 shown in fig. 7.
Illustratively, the computer program 803 may be divided into one or more modules/units, which are stored in the memory 802 and executed by the processor 801 to accomplish the present application. One or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 803 in the electronic device 800. For example, the computer program 803 may be divided into a file parsing unit and a node processing unit, and specific functions of each unit are described in the foregoing embodiments and are not described herein again.
The electronic device 800 may be a server, a desktop computer, a tablet computer, a cloud server, a mobile terminal, and other computing devices. The electronic device 800 may include, but is not limited to, a processor 801, a memory 802. Those skilled in the art will appreciate that fig. 8 is merely an example of an electronic device 800 and does not constitute a limitation of electronic device 800, and may include more or fewer components than shown, or some components in combination, or different components, e.g., an electronic device may also include input-output devices, network access devices, buses, etc.
The Processor 801 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 802 may be an internal storage unit of the electronic device 800, such as a hard disk or a memory of the electronic device 800. The memory 802 may also be an external storage device of the electronic device 800, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device 800. Further, the memory 802 may also include both internal storage units and external storage devices of the electronic device 800. The memory 802 is used to store computer programs and other programs and data required by the electronic device. The memory 802 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/electronic device and method may be implemented in other ways. For example, the above-described apparatus/electronic device embodiments are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated module, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method according to the embodiments described above may be implemented by a computer program, which is stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, in accordance with legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunications signals.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of file processing, the method comprising:
analyzing a file to be processed to obtain a node of the file to be processed;
and responding to the fact that the node is a signature node, generating a code for realizing the step of selecting the program node according to a pre-constructed association information set, and writing the generated code into the signature node to realize the execution of the program of the selected program node when the signature node is called, wherein the association information in the association information set is used for describing the association relationship between the signature node and the program node.
2. The method of claim 1, wherein the step of selecting a program node comprises:
selecting associated information from the associated information set, and executing a validity judgment step: in response to determining that the validity of the program node corresponding to the selected association information is true, selecting the corresponding program node;
and in response to determining that the validity of the program node corresponding to the selected associated information is false, selecting unselected associated information from the associated information set, and continuing to execute the validity judgment step.
3. The method of claim 2, wherein the validity of the program node is positively correlated to the value of a predetermined parameter in the program node; and
in response to determining that the validity of the program node corresponding to the selected association information is true, selecting the corresponding program node includes:
and in response to the fact that the value of the preset parameter is larger than a preset value, determining that the validity of the program node corresponding to the selected associated information is true, and selecting the corresponding program node.
4. The method of claim 3, wherein selecting the non-selected association information from the association information set in response to determining that the validity of the program node corresponding to the selected association information is false comprises:
and in response to the fact that the value of the preset parameter is smaller than or equal to a preset value, determining that the validity of the program node corresponding to the selected associated information is false, and selecting the unselected associated information from the associated information set.
5. The method of claim 1, wherein the association information in the association information set comprises a name of a signature node and attribute information associated with the name of the signature node, and wherein the attribute information comprises a name of a program node, a name of the signature node, and a storage address of the program node.
6. The method according to one of the claims 1 to 5, wherein the pre-constructed association information set is obtained by:
when the file to be processed is analyzed, traversing the nodes of the file to be processed, and when the current node is accessed, executing the following storage operation: responding to the fact that the current node is a program node, storing the current node and obtaining attribute information of the current node; and in response to the acquired attribute information including the name of the signature node, storing the included name of the signature node and the attribute information of the current node in association with each other into an association information set.
7. The method of claim 6, wherein the storing operation further comprises: in response to the current node being a node other than the program node, storing the current node.
8. A document processing apparatus, characterized in that the apparatus comprises:
the file analysis unit is used for analyzing the file to be processed to obtain a node of the file to be processed;
and the node processing unit is used for responding to the fact that the node is a signature node, generating a code for realizing the step of selecting the program node according to a pre-constructed associated information set, and writing the generated code into the signature node so as to realize the execution of the program of the selected program node when the signature node is called, wherein the associated information in the associated information set is used for describing the association relationship between the signature node and the program node.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202011035738.3A 2020-09-27 2020-09-27 File processing method, device, equipment and medium Active CN112181539B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011035738.3A CN112181539B (en) 2020-09-27 2020-09-27 File processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011035738.3A CN112181539B (en) 2020-09-27 2020-09-27 File processing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN112181539A true CN112181539A (en) 2021-01-05
CN112181539B CN112181539B (en) 2023-12-05

Family

ID=73944829

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011035738.3A Active CN112181539B (en) 2020-09-27 2020-09-27 File processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112181539B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101887365A (en) * 2009-05-15 2010-11-17 国际商业机器公司 Be used to construct method and system based on the executable code of the application of assembly
CN102708013A (en) * 2011-03-07 2012-10-03 英飞凌科技股份有限公司 Program-instruction-controlled instruction flow supervision
CN106372500A (en) * 2015-07-24 2017-02-01 英飞凌科技股份有限公司 Method for determining an intergrity of an execution of a code fragment and a method for providing an abstracted representation of a program code
CN107291476A (en) * 2017-06-27 2017-10-24 北京微影时代科技有限公司 Canvas code generating methods, device, electronic equipment and storage medium
JP2019164509A (en) * 2018-03-19 2019-09-26 株式会社リコー Information processing device, program, and information processing system
CN111684445A (en) * 2018-02-07 2020-09-18 索尼公司 Information processing apparatus, information processing method, and program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101887365A (en) * 2009-05-15 2010-11-17 国际商业机器公司 Be used to construct method and system based on the executable code of the application of assembly
CN102708013A (en) * 2011-03-07 2012-10-03 英飞凌科技股份有限公司 Program-instruction-controlled instruction flow supervision
CN106372500A (en) * 2015-07-24 2017-02-01 英飞凌科技股份有限公司 Method for determining an intergrity of an execution of a code fragment and a method for providing an abstracted representation of a program code
CN107291476A (en) * 2017-06-27 2017-10-24 北京微影时代科技有限公司 Canvas code generating methods, device, electronic equipment and storage medium
CN111684445A (en) * 2018-02-07 2020-09-18 索尼公司 Information processing apparatus, information processing method, and program
JP2019164509A (en) * 2018-03-19 2019-09-26 株式会社リコー Information processing device, program, and information processing system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
程雪红等: "基于代理/服务的XML数字签名研究", 《计算机安全》 *

Also Published As

Publication number Publication date
CN112181539B (en) 2023-12-05

Similar Documents

Publication Publication Date Title
CN108427731B (en) Page code processing method and device, terminal equipment and medium
CN111352902A (en) Log processing method and device, terminal equipment and storage medium
CN111737564B (en) Information query method, device, equipment and medium
CN110888817B (en) Code coverage rate report generation method, device and readable storage medium
CN112181924A (en) File conversion method, device, equipment and medium
CN111553652B (en) Service processing method and device
CN115827436A (en) Data processing method, device, equipment and storage medium
CN110297764B (en) Vulnerability test model training method and device
WO2007087073A1 (en) Analyzing interpretable code for harm potential
CN112799763A (en) Function management method, management device, terminal equipment and readable storage medium
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN112181539B (en) File processing method, device, equipment and medium
CN111736848B (en) Packet conflict positioning method, device, electronic equipment and readable storage medium
CN114936368A (en) Java memory Trojan detection method, terminal device and storage medium
CN114090514A (en) Log retrieval method and device for distributed system
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN112907198A (en) Service state circulation maintenance method and device and electronic equipment
CN113342647A (en) Test data generation method and device
CN108628909B (en) Information pushing method and device
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body
CN114449052B (en) Data compression method and device, electronic equipment and storage medium
CN111178044B (en) Method and device for determining target text elements
CN113326171B (en) Memory data processing method and device and electronic equipment
CN115952172B (en) Data matching method and device based on database temporary table
CN117171030A (en) Method, device, equipment and storage medium for detecting software running environment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant