CN113821210A - File analysis method and device and storage medium - Google Patents

File analysis method and device and storage medium Download PDF

Info

Publication number
CN113821210A
CN113821210A CN202111091392.3A CN202111091392A CN113821210A CN 113821210 A CN113821210 A CN 113821210A CN 202111091392 A CN202111091392 A CN 202111091392A CN 113821210 A CN113821210 A CN 113821210A
Authority
CN
China
Prior art keywords
rule
node
file
information
xml 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.)
Pending
Application number
CN202111091392.3A
Other languages
Chinese (zh)
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.)
China Automotive Innovation Co Ltd
Original Assignee
China Automotive Innovation 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 China Automotive Innovation Co Ltd filed Critical China Automotive Innovation Co Ltd
Priority to CN202111091392.3A priority Critical patent/CN113821210A/en
Publication of CN113821210A publication Critical patent/CN113821210A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

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

Abstract

The invention provides a file analysis method, a file analysis device and a storage medium. The file analysis method comprises the following steps: acquiring a target rule file; determining file summary information, rule summary information and rule content information of a target rule file; creating an XML file according to the file summary information, the rule summary information and the rule content information, wherein the XML file comprises a root node, a rule summary node and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node; and analyzing the XML file to obtain target rule code information. The method comprises the steps of firstly creating an XML file which is easy to analyze according to a target rule file, then analyzing the XML file to obtain target rule code information, wherein the target rule code information is code form information corresponding to the target rule file, and the target rule code information can be used for program static inspection, so that the technical problem that code information corresponding to a language development standard file is difficult to obtain during program static inspection is solved.

Description

File analysis method and device and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a file parsing method, a file parsing device and a storage medium.
Background
The static program inspection is a code analysis technology which scans program codes through the technologies of lexical analysis, syntactic analysis, control flow, data flow analysis and the like and verifies whether the codes meet the indexes of normalization, safety, reliability, maintainability and the like in a mode of not running the codes.
MISRA C is a C language development standard proposed by the automotive industry software reliability association (MISRA), contains a series of rule descriptions for C language static inspection, and is an unstructured document for human reading. In the static program inspection, the C source program needs to be inspected according to the rules of the MISRA C, and the output result is provided for a program developer to modify and perfect the C program source code, so that the C source code finally meets the requirements of the rules of the MISRA C.
Since the MISRA C is an unstructured document, code information usable for static inspection of a program needs to be obtained from the unstructured MISRA C, the existing processing procedure is very complicated and the obtained code information is inaccurate.
Disclosure of Invention
In view of this, the present application provides a file parsing method, an apparatus and a storage medium, which can at least solve the technical problem in the prior art that it is difficult to obtain code information corresponding to a language development standard file.
According to an aspect of the present application, there is provided a file parsing method, including:
acquiring a target rule file;
determining file summary information, rule summary information and rule content information of the target rule file;
creating an XML file according to the file summary information, the rule summary information and the rule content information, wherein the XML file comprises a root node, a rule summary node and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node;
and analyzing the XML file to obtain target rule code information.
In one possible implementation, the creating an XML file according to the file summary information, the rule summary information, and the rule content information includes:
determining attribute information of a root node of the XML file according to the file summary information;
determining attribute information of a rule summary node of the XML file according to the rule summary information;
and determining the attribute information of the rule content node of the XML file according to the rule content information.
In one possible implementation manner, the attribute information of the root node includes file type information and file version information.
In one possible implementation, the attribute information of the rule summary node includes rule number information, rule summary information, and rule class information.
In one possible implementation, the root node includes a plurality of the rule summary nodes.
In one possible implementation, the types of the rule content nodes include an analysis node type, an application node type, an extension node type, a principle node type, an exception node type, an example node type, and a reference node type.
In a possible implementation manner, the parsing the XML file to obtain the target rule code information includes:
and analyzing the root node, the rule summary node and the rule content node of the XML file to obtain the target rule code information.
In a possible implementation manner, the format of the target rule file is DOC format or PDF format.
According to another aspect of the present application, there is provided a file parsing apparatus including:
the acquisition module is used for acquiring a target rule file;
the first determining module is used for determining file summary information, rule summary information and rule content information of the target rule file;
a second determining module, configured to create an XML file according to the file summary information, the rule summary information, and the rule content information, where the XML file includes a root node, a rule summary node, and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node;
and the analysis module is used for analyzing the XML file to obtain target rule code information.
According to another aspect of the application, a non-transitory computer-readable storage medium is provided, having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the above-described method.
According to the method, an XML file which is easy to analyze is created according to a target rule file, then the XML file is analyzed according to the structure of the XML file to obtain target rule code information, the target rule code information is code form information corresponding to the target rule file, the target rule code information can be used for program static inspection, and the technical problem that code information corresponding to a language development standard file is difficult to obtain during program static inspection is solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow diagram illustrating a file parsing method in accordance with an exemplary embodiment;
FIG. 2 is a schematic flow diagram illustrating a file parsing method in accordance with another exemplary embodiment;
FIG. 3 is a block diagram illustrating a file parsing apparatus according to an example embodiment.
Detailed Description
Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present application. It will be understood by those skilled in the art that the present application may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present application.
The invention provides a file parsing method, a file parsing device and a storage medium, which can at least solve the technical problem that code information corresponding to a MISRA C is difficult to obtain in the prior art.
With reference to fig. 1 to fig. 2, a file parsing method provided in an embodiment of the present specification includes the following contents.
Step S101: and acquiring a target rule file.
The target rule file in the embodiment of the present specification may be an industry standard file, and may be a C language development standard (MISRA C) proposed by the automobile industry software reliability association (MISRA).
Step S102: file summary information, rule summary information, and rule content information of the target rule file are determined.
In this embodiment of the present specification, the file summary information may characterize the type of the file, the rule summary information may characterize the summary content of the rule, and the rule content information may characterize the specific content of the rule. The file summary information, rule summary information, and rule content information may be determined from the content described by the target rule file.
Step S103: and creating an XML file according to the file summary information, the rule summary information and the rule content information, wherein the XML file comprises a root node, a rule summary node and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node.
XML is an extensible markup language. In this embodiment of the present specification, the file summary information, the rule summary information, and the rule content information may correspond to a root node, a rule summary node, and a rule content node of the XML file, respectively.
Step S104: and analyzing the XML file to obtain target rule code information.
In this embodiment of the present specification, a corresponding XML file may be obtained according to a target rule file, and then the XML file may be analyzed according to a structure of the XML file, so as to obtain target rule code information, where the target rule code information may correspond to content recorded in the target rule file. The target rule code information may be used for program static checking.
In the embodiment of the specification, an XML file which is easy to parse is created according to a target rule file, and then the XML file is parsed according to the structure of the XML file to obtain target rule code information, where the target rule code information is code form information corresponding to the target rule file, and the target rule code information can be used for program static inspection, so that the technical problem that code information corresponding to a language development standard file such as a MISRAC file is difficult to obtain during program static inspection is solved.
The XML file in the embodiment of the present specification may be used to represent the rules of the MISRAC, so as to facilitate the static inspection program to read the rules of the MISRAC, and facilitate the processing in units of a single MISRA C rule during the static inspection of the program. Compared with unstructured file formats such as doc/pdf and the like, the XML format file can accurately represent all static inspection rules of MISRAC, is easy to modify and expand, and is convenient for increasing and decreasing the rules to customize new specifications.
In one possible implementation, step S103 includes:
step S1031: determining attribute information of a root node of the XML file according to the file summary information;
step S1032: determining attribute information of a rule summary node of the XML file according to the rule summary information;
step S1033: and determining the attribute information of the rule content node of the XML file according to the rule content information.
In the embodiment of the present specification, the attribute information of the root node may be determined according to the file summary information, and the attribute information of the root node is written into the root node of the XML file; determining attribute information of the rule summary node according to the rule summary information, and writing the attribute information of the rule summary node into the rule summary node of the XML file; the attribute information of the rule content node can be determined according to the rule content information, and the attribute information of the rule content node is written into the rule content node of the XML file. The XML file in the embodiment of the specification has a simple structure and is easy to analyze, and the process of creating the XML file is simple and efficient.
In one possible implementation, the attribute information of the root node includes file type information and file version information.
The attribute information of the root node in the embodiment of the present specification can embody file type information and file version information, which is convenient for fast analysis and timely learning of the file type information and the file version information.
In this embodiment of the present specification, a root node may be regarded as a RULES, and an attribute of the root node may include a file type and a file version.
If the file type is "MISRAC", the file version may take the version number corresponding to MISRAC such as 1998, 2004, 2012, etc., and the corresponding code in the XML file may be: < RULES type ═ MISRAC "version ═ 2012" >.
If the file type is "[ custom type ]", the file version may take the values: the corresponding code in the XML file may be: < RULES type ═ department C language specification "version ═ v 1.0" >.
In one possible implementation, the attribute information of the rule summary node includes rule number information, rule summary information, and rule class information.
The attribute information of the summary node in the embodiments of the present description may embody rule number information, rule summary information, and rule level information, which is convenient for fast parsing and timely obtaining the rule number information, the rule summary information, and the rule level information.
In this embodiment, the RULE summary node may be called RULE, and the attributes of the RULE summary node may include a RULE number id, a RULE summary and a RULE class category.
If the file type is "MISRAC", the rule number id may be valued as the corresponding rule number: 1.3, 2.1, etc., the corresponding code in the XML file may be: < RULE id ═ 1.1 > </RULE >.
If the file type is ═ custom type ] ", the rule number id may take the value of [ custom type rule number ], and the corresponding code in the XML file may be: < RULE id ═ 123 "> </RULE >.
Rule summary may take the value [ brief description of rule ], and the corresponding code in the XML file may be: < RULE id ═ 2.1 "summary ═ A project shell not contact in unacable code" >.
The rule level category may take the value of either category, required, or advisory. The mandatory nature of the mandatorey, required, advisory varies from high to low. The directory may represent that the rule level is a higher mandatory level, the required may represent that the rule level is a higher demand level, and the advisory may represent that the rule level is a suggested level. The corresponding code in the XML file may be:
<RULE id=“2.1”summary=“Aproject shall not contain unreachable code”category=“mandatory”>...</RULE>
<RULE id=“2.2”summary=“Aproject shall not contain unreachable code”category=“required”>...</RULE>
<RULE id=“2.3”summary=“Aproject shall not contain unreachable code”category=“advisory”>...</RULE>。
in one possible implementation, the root node includes a plurality of rule summary nodes.
In this embodiment of the present specification, the number of the rule summary nodes may correspond to the number of the rules in the target rule file, so that the XML file corresponds to the target rule file, and the accuracy of the XML file after parsing is ensured. The plurality of rule summary nodes correspond to the plurality of rules in the target rule file one to one.
In one possible implementation, the types of rule content nodes include an analysis node type, an application node type, an extension node type, a principle node type, an exception node type, an example node type, and a reference node type.
In this specification embodiment, a rule summary node may include one or more rule content nodes, and a rule summary node may include one or more of an analysis node, an application node, an extension node, a principle node, an exception node, an example node, and a reference node.
The attribute information of the rule content node in the embodiment of the present specification may embody application information, extension information, principle information, example information, and reference information.
In this embodiment of the present specification, an Analysis node may be recorded as Analysis, an application node may be recorded as AppliesTo, an expansion node may be recorded as Amplification, a principle node may be recorded as ratio, an Exception node may be recorded as Exception, an Example node may be recorded as Example, and a reference node may be recorded as seeall.
The type of the rule summary node in the embodiments of the present specification may be determined according to the rule content type in the MISRA C file. For Example, in the 1.1 st rule of MISRA C, Analysis, AppliesTo, Amplification, ratio, Example, and seeall are set; in the XML file, the rule summary nodes corresponding to the rule of clause 1.1 of the MISRAC may include an Analysis node Analysis, an application node AppliesTo, an extension node Amplification, a principle node ratio, an Example node Example, and a reference node seeall.
In the embodiment of the present specification, the attribute of the Analysis node Analysis may include decidability and scope. The value of the decidability can be decidable or undecidable; the range scope can take the value of "Single Translation Unit" or "System". The corresponding code in the XML file may be: the term "System" is used to mean either < Analysis specificity ═ definition "scope ═ Single transformation Unit"/>, or < Analysis specificity ═ approximation "scope ═ System"/>.
The attributes of the application node AppliesTo may include attribute c90 and attribute c 99. The value of the attribute c90 can be true or false; the value of the attribute c99 may be true or false. The corresponding code in the XML file may be: < AppliesTo c90 ═ true "c 99 ═ false"/>, or < AppliesTo c90 ═ false "c 99 ═ true"/>.
The attribute of the extension node being Amplification may include an extension specification CDATA. The value of CDATA may be the extended specification for c90 and c 99. The corresponding code in the XML file may be:
<Amplification>
<![CDATA[
This rule requires that different“external identifiers”be distinct within the limites imposedbythe implementation.
The definition of distinct depends on the implementabtion and on the version ofthe C language the is being used:
In C90 the minimum requirement is that the first 6characters of“external identifiers”are significantbuttheir case is notrequired to be signification.
In C99 the minimum requirement is that the first 31characters of“external idenfifiers”are significant,with each universal character or corresponding extended source character occupyingbetween 6and 10characters.
]]>
</Amplification>
the attribute of the principle node ratio may include a principle specification CDATA. Description of the principle the value of CDATA may be a description of the principle of the parent element RULE. The corresponding code in the XML file may be:
<Rationle>
<![CDATA[
Iftwo identifiers differ only in non-significant characters,the behaviour is undefined.
Ifportability is a concern,it would be prudent to apply this rule using the minimum limits specified in The Standard.
Long identifiers may impair the readability ofcode.While many automatic code generation systems produce long identifiers,there is a good argument for keeping idendifier lengths wellbelow this limit.
]]>
</Rationle>
the attribute of Exception node Exception may include an Exception specification CDATA. The value of CDATA may be illustrative of an abnormal situation. The corresponding code in the XML file may be:
<Exception>
<![CDATA[
The tag name may be the same as the“typedef”with which it is associated.
]]>
</Exception>
the properties of the Example node Example may include an Example specification CDATA. Illustrating that the value of CDATA may be a C source code illustration to the parent element RULE. The corresponding code in the XML file may be:
Figure BDA0003267621850000091
Figure BDA0003267621850000101
the reference node SeeAlso may include one or more reference child nodes, and the attribute of the reference child node may be an attribute id or an attribute class. For example, the attribute id of the reference child node refer may take the value [ id of the reference Rule ], and the attribute class of the reference child node refer may take the values Dir, Rule. The corresponding code in the XML file may be:
<SeeAlso>
<refer class=“Dir”id=“5.2”/>
<refer class=“Rule”id=“3.4”/>
</SeeAlso>
some XML elements have complicated text contents, such as "Amplification" element, the contents have multiple lines and may contain various special characters (such as "<", ">", carriage return, line change, etc.), if these carriage return line change and special characters are not processed, then parsing the XML file will be erroneous, so in this embodiment of the present specification, the text contents of all XML elements are accessed according to CDATA section data, and the representation in the corresponding XML file is < XML element > < | | in this embodiment, the XML file is not accessed according to CDATA section data. [ CDATA [ multiple lines of complex text content ] ] > </XML element >, < XML element >, which remains as is if parsed to find text in a CDATA section (CDATAsection). The XML element only contains text content or other sub-elements; but it is not allowed that the XML element cannot contain both text content and other sub-elements at the same time. Therefore, the XML file in the embodiment of the specification is not easy to generate errors in parsing.
In one possible implementation, step S104 includes step S1041: and analyzing the root node, the rule summary node and the rule content node of the XML file to obtain target rule code information.
In this embodiment, the XML file may be read according to the structure of the XML file. The overall flow of parsing the XML file is as follows: analyzing to obtain an RULES element object, obtaining the RULES element object, calling a getAttribute interface to obtain type attribute information of the RULES element, calling the getAttribute interface to obtain version attribute information of the RULES element, calling a getChildNodes interface to analyze to obtain a child node list of the RULES element, sequentially taking each child node in the child node list, analyzing the RULE element if the child node is the RULE element, and returning to sequentially take each child node in the child node list until the child node list is traversed; and if the child node is not the RULE element, returning to sequentially take each child node in the child node list.
The flow of parsing the RULE element is as follows: calling getAttribute interface to obtain id attribute information of RULE element, calling getAttribute interface to obtain summary attribute information of RULE element, calling getChildNodes interface to analyze and obtain child node list of RULE element, sequentially taking each child node in child node list, analyzing element information of Analysis node Analysis if child node is Analysis node Analysis, analyzing element information of application node application if child node is application node application, analyzing element information of expansion node Amplification if child node is expansion node Amplification, analyzing element information of principle node random if child node is principle node random, analyzing element information of Exception node exposure if child node is Exception node exposure, analyzing instance node exposure if child node is instance node exposure, analyzing element reference node if child node is instance node Analysis element, and completing traversal of the child node list under the RULE element.
When analyzing the Analysis node, the getAttribute interface can be called to obtain the facility attribute information of the Analysis element, and the getAttribute interface can be called to obtain the scope attribute information of the Analysis element.
When the application node AppliesTo is analyzed, a getAttribute interface can be called to acquire the c90 attribute information of the AppliesTo element, and the getAttribute interface is called to acquire the c99 attribute information of the AppliesTo element.
When analyzing the expansion node Amplification, the getTextContent interface can be called to obtain the CDATA attribute information of the Amplification element.
When the principle node ratio is analyzed, a getTextContent interface can be called to acquire CDATA attribute information of a ratio element.
When the Exception node Exception is analyzed, the getTextContent interface can be called to acquire the CDATA attribute information of the Exception element.
When the Example node instance is parsed, the getTextContent interface can be called to obtain the CDATA attribute information of the instance element.
When the reference node SeeAlso is analyzed, each child node in a child node list under the reference node SeeAlso can be sequentially acquired, if the child node is a referrer, a getAttribute interface can be called to acquire id attribute information of the referrer element, and the getAttribute interface is called to acquire class attribute information of the referrer element until traversal of the child node list under the reference node SeeAlso is completed.
In one possible implementation, the format of the target rule file is DOC format or PDF format. The target rule file in the embodiment of the present specification may be a MISRAC file.
With reference to fig. 3, an embodiment of the present specification further provides a file parsing apparatus, including:
an obtaining module 10, configured to obtain a target rule file;
a first determining module 20, configured to determine file summary information, rule summary information, and rule content information of the target rule file;
a second determining module 30, configured to create an XML file according to the file summary information, the rule summary information, and the rule content information, where the XML file includes a root node, a rule summary node, and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node;
and the analysis module 40 is used for analyzing the XML file to obtain the target rule code information.
In the embodiment of the specification, an XML file which is easy to parse is created and obtained according to a target rule file, and then the XML file is parsed according to the structure of the XML file to obtain target rule code information, so that code form information corresponding to the target rule file is obtained, static inspection of a program is facilitated, and the technical problem that code information corresponding to language development standards such as MISRAC is difficult to obtain during static inspection of the program is solved.
The XML file in the embodiment of the present specification is used to indicate the rules of the MISRAC, so that the static inspection program can conveniently read the rules of the MISRAC, and the static inspection program can conveniently process the MISRAC by taking a single rule of the MISRAC as a unit. Compared with unstructured file formats such as doc/pdf and the like, the XML format file can accurately represent all static inspection rules of MISRAC, is easy to modify and expand, and is convenient for increasing and decreasing the rules to customize new specifications.
In one possible implementation, the second determining module includes:
the first determining unit is used for determining the attribute information of the root node of the XML file according to the file summary information;
a second determining unit, configured to determine attribute information of a rule summary node of the XML file according to the rule summary information;
and the third determining unit is used for determining the attribute information of the rule content node of the XML file according to the rule content information.
In one possible implementation, the attribute information of the root node includes file type information and file version information.
In one possible implementation, the attribute information of the rule summary node includes rule number information, rule summary information, and rule class information.
In one possible implementation, the root node includes a plurality of rule summary nodes.
In one possible implementation, the types of rule content nodes include an analysis node type, an application node type, an extension node type, a principle node type, an exception node type, an example node type, and a reference node type.
In a possible implementation manner, the parsing module includes a parsing unit, and the parsing unit is configured to parse a root node, a rule summary node, and a rule content node of an XML file to obtain target rule code information.
In one possible implementation, the format of the target rule file is DOC format or PDF format.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Furthermore, embodiments of the present specification also provide a non-volatile computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions, when executed by a processor, implement the file parsing method described above.
The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present application.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present application may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry can execute computer-readable program instructions to implement aspects of the present application by utilizing state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present application are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present application, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. A file parsing method, comprising:
acquiring a target rule file;
determining file summary information, rule summary information and rule content information of the target rule file;
creating an XML file according to the file summary information, the rule summary information and the rule content information, wherein the XML file comprises a root node, a rule summary node and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node;
and analyzing the XML file to obtain target rule code information.
2. The file parsing method of claim 1 wherein said creating an XML file based on said file summary information, said rule summary information, and said rule content information comprises:
determining attribute information of a root node of the XML file according to the file summary information;
determining attribute information of a rule summary node of the XML file according to the rule summary information;
and determining the attribute information of the rule content node of the XML file according to the rule content information.
3. The file parsing method of claim 2, wherein the attribute information of the root node includes file type information and file version information.
4. The file parsing method according to claim 2 or 3, wherein the attribute information of the rule summary node includes rule number information, rule summary information, and rule level information.
5. The file parsing method of claim 1 wherein said root node comprises a plurality of said rule summary nodes.
6. The file parsing method of claim 1 wherein the types of rule content nodes comprise an analytics node type, an applications node type, an extension node type, a principals node type, an exception node type, an example node type, and a reference node type.
7. The file parsing method of claim 1, wherein parsing the XML file to obtain target rule code information comprises:
and analyzing the root node, the rule summary node and the rule content node of the XML file to obtain the target rule code information.
8. The file parsing method according to claim 1, wherein the format of the target rule file is DOC format or PDF format.
9. A file parsing apparatus, comprising:
the acquisition module is used for acquiring a target rule file;
the first determining module is used for determining file summary information, rule summary information and rule content information of the target rule file;
a second determining module, configured to create an XML file according to the file summary information, the rule summary information, and the rule content information, where the XML file includes a root node, a rule summary node, and a rule content node, the rule summary node is a child node of the root node, and the rule content node is a child node of the rule summary node;
and the analysis module is used for analyzing the XML file to obtain target rule code information.
10. A non-transitory computer readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method of any of claims 1 to 8.
CN202111091392.3A 2021-09-17 2021-09-17 File analysis method and device and storage medium Pending CN113821210A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111091392.3A CN113821210A (en) 2021-09-17 2021-09-17 File analysis method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111091392.3A CN113821210A (en) 2021-09-17 2021-09-17 File analysis method and device and storage medium

Publications (1)

Publication Number Publication Date
CN113821210A true CN113821210A (en) 2021-12-21

Family

ID=78922244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111091392.3A Pending CN113821210A (en) 2021-09-17 2021-09-17 File analysis method and device and storage medium

Country Status (1)

Country Link
CN (1) CN113821210A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279792A (en) * 2011-07-25 2011-12-14 大连理工大学 Method for establishing security testing rule base based on extensive makeup language (XML) intermediate model
CN105022619A (en) * 2014-04-25 2015-11-04 无锡物联网产业研究院 Code processing method and device
CN108255494A (en) * 2018-01-30 2018-07-06 平安科技(深圳)有限公司 A kind of XML file analytic method, device, computer equipment and storage medium
CN108984174A (en) * 2018-07-03 2018-12-11 百度在线网络技术(北京)有限公司 Cross-platform application creation method, device, server and storage medium
US20190392329A1 (en) * 2018-06-25 2019-12-26 Tata Consultancy Services Limited Automated extraction of rules embedded in software application code using machine learning
CN110750459A (en) * 2019-10-23 2020-02-04 天津汇缘诚信科技有限公司 White box analysis-based method for automatically generating test cases and managing test processes
CN112182305A (en) * 2020-09-26 2021-01-05 广州鲁邦通物联网科技有限公司 XML (extensive markup language) analysis module and method based on XML rules and management method of configuration data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102279792A (en) * 2011-07-25 2011-12-14 大连理工大学 Method for establishing security testing rule base based on extensive makeup language (XML) intermediate model
CN105022619A (en) * 2014-04-25 2015-11-04 无锡物联网产业研究院 Code processing method and device
CN108255494A (en) * 2018-01-30 2018-07-06 平安科技(深圳)有限公司 A kind of XML file analytic method, device, computer equipment and storage medium
US20190392329A1 (en) * 2018-06-25 2019-12-26 Tata Consultancy Services Limited Automated extraction of rules embedded in software application code using machine learning
CN108984174A (en) * 2018-07-03 2018-12-11 百度在线网络技术(北京)有限公司 Cross-platform application creation method, device, server and storage medium
CN110750459A (en) * 2019-10-23 2020-02-04 天津汇缘诚信科技有限公司 White box analysis-based method for automatically generating test cases and managing test processes
CN112182305A (en) * 2020-09-26 2021-01-05 广州鲁邦通物联网科技有限公司 XML (extensive markup language) analysis module and method based on XML rules and management method of configuration data

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
HONGBO ZHENG 等: "Research on XML Based Static Software Security Analysis", 《2010 SECOND WRI WORLD CONGRESS ON SOFTWARE ENGINEERING》, pages 1 - 4 *
XIAOCHEN LAI 等: "A Method of Software Defects Mining Based on Static Analysis*", 《SPRINGER》, pages 794 *
廖丹: "基于MISRA标准的通用C语言自动化检测工具", 《中国优秀硕士学位论文全文数据库 信息科技辑》, pages 138 - 656 *

Similar Documents

Publication Publication Date Title
US8434062B2 (en) Enhancing source code debugging and readability using visual symbols
CN109814866B (en) Processing method and device for converting page application into native application
US20150169320A1 (en) Verification of backward compatibility of software components
CN110489087B (en) Method, device, medium and electronic equipment for generating fractal structure
US9417991B2 (en) Translation verification testing
US10019426B2 (en) Generating data format description language schema
US10255046B2 (en) Source code analysis and adjustment system
CN112181924A (en) File conversion method, device, equipment and medium
CN111984262A (en) WeChat cascading style sheet file processing method, device, equipment and storage medium
CN114168149A (en) Data conversion method and device
US20170124214A1 (en) Determining data field offsets using a document object model representation
CN113760721A (en) Page testing method and device
CN113821210A (en) File analysis method and device and storage medium
CN115357286B (en) Program file comparison method and device, electronic equipment and storage medium
US11994980B2 (en) Method, device and computer program product for application testing
CN111539200B (en) Method, device, medium and electronic equipment for generating rich text
CN113377648B (en) Software system diagnosis method, device, electronic equipment and computer readable medium
CN111708819B (en) Method, apparatus, electronic device, and storage medium for information processing
CN112286784B (en) Test case generation method, device, server and storage medium
CN110737431A (en) Software development method, development platform, terminal device and storage medium
CN112162738B (en) Data conversion method and device, terminal equipment and storage medium
CN113742225B (en) Test data generation method, device, equipment and storage medium
CN116069633B (en) Code checking method and device, electronic equipment and storage medium
CN113704020B (en) Method and device for analyzing error field data of solid state disk
CN112632955B (en) Text set generation method and device, electronic equipment and medium

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