CN109710808B - XML file analysis method, system, device and readable storage medium - Google Patents

XML file analysis method, system, device and readable storage medium Download PDF

Info

Publication number
CN109710808B
CN109710808B CN201811626079.3A CN201811626079A CN109710808B CN 109710808 B CN109710808 B CN 109710808B CN 201811626079 A CN201811626079 A CN 201811626079A CN 109710808 B CN109710808 B CN 109710808B
Authority
CN
China
Prior art keywords
label
analysis
class
target sub
sub
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.)
Active
Application number
CN201811626079.3A
Other languages
Chinese (zh)
Other versions
CN109710808A (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 CN201811626079.3A priority Critical patent/CN109710808B/en
Publication of CN109710808A publication Critical patent/CN109710808A/en
Application granted granted Critical
Publication of CN109710808B publication Critical patent/CN109710808B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application discloses an XML file parsing method, system, device and readable storage medium, comprising the following steps: step S1: positioning a target tag position in an XML file; step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass; if the analysis class is a subclass, calling a corresponding father analysis function, positioning to the position of the target label, and executing step S3; if the analysis class is the label class, executing the step S3; if the analysis class is a group, the position of the target label is saved and the step S4 is executed; step S3: entering a target label and storing the position after entering; acquiring a target tag attribute value; step S4: traversing to obtain all target sub-labels, calling sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing. According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.

Description

XML file analysis method, system, device and readable storage medium
Technical Field
The invention relates to the technical field of automobile diagnosis, in particular to an XML file analysis method, an XML file analysis system, an XML file analysis device and a readable storage medium.
Background
ODX (Open Diagnostic Data Exchange ) is an open diagnostic data format that is widely used in the interaction of diagnostic data throughout the life cycle of a vehicle. At present, the latest version of ODX is 2.2.0, and the whole ODX data model is divided into layers such as ODX-D, ODX-C, ODX-V, ODX-E, ODX-FD, ODX-F, ODX-M and the like. When ODX is applied, the XML file conforming to the ODX standard is required to be analyzed according to the ODX standard rule file, so that the data in the XML (Extensible Markup Language extensible markup language) file is obtained; how to find the parsing method according to the ODX standard can be said to be one of the core technology and key steps of ODX application, if no parsing method or improper parsing is found, it is difficult to obtain the complex XML data, and ODX cannot be applied efficiently.
Therefore, how to provide a solution to the above technical problem is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
Accordingly, the present invention is directed to a method, a system, a device and a readable storage medium for parsing an XML file, so as to quickly and correctly parse an XML file of an ODX standard. The specific scheme is as follows:
an XML file parsing method is applied to an XML file conforming to an ODX standard, and comprises the following steps:
step S1: positioning the position of a target label in the XML file;
step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass;
if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3;
if the analysis class is the label class, executing a step S3;
if the analysis class is the group, the position of the target label is saved and the step S4 is executed;
step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag;
step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing.
Preferably, the step S4 specifically includes:
step S41: acquiring a current target sub-label according to the stored current position;
step S42: acquiring a type analysis class corresponding to a current target sub-label;
step S43: invoking a sub-parsing function of the current type parsing class to obtain a parsing class object of the current target sub-tag and storing the parsing class object;
step S44: the position of the current target sub-label is saved and steps S41-S43 are circulated until the next target sub-label is not acquired.
Preferably, after the type analysis class corresponding to the current target sub-tag is obtained, the method specifically further includes:
it is determined whether the current target sub-tag is responsible for the current type parsing class, if yes, step S43 is performed, and if no, step S44 is performed.
Preferably, the process of obtaining the type analysis class corresponding to the current target sub-label specifically includes:
and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
Preferably, the process of obtaining and storing the analysis class object of the current target sub-label further includes:
if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
Correspondingly, the invention also discloses an XML file analysis system which is applied to the XML file conforming to the ODX standard and comprises:
the positioning module is used for positioning the position of the target tag in the XML file;
the judging module is used for judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass; if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and triggering a processing module; if the analysis class is the label class, triggering the processing module; if the analysis class is the group, the position of the target label is saved and an analysis module is triggered;
the processing module is used for entering the target label and storing the position after entering so as to position a first target sub-label; acquiring an attribute value of the target tag;
the analysis module is used for traversing and acquiring all target sub-labels, calling corresponding sub-analysis functions, acquiring analysis class objects of the target sub-labels and storing the analysis class objects.
Preferably, the parsing module specifically includes:
the sub-tag obtaining unit is used for obtaining a current target sub-tag according to the stored current position;
the analysis class acquisition unit is used for acquiring a type analysis class corresponding to the current target sub-label;
the function calling unit is used for calling the sub-analysis function of the current type analysis class, obtaining the analysis class object of the current target sub-label and storing the analysis class object;
and the circulation unit is used for storing the position of the current target sub-label and triggering the sub-label acquisition unit until the next target sub-label is not acquired.
Preferably, the parsing class acquisition unit is further configured to:
and judging whether the current target sub-label is responsible for the current type analysis class, if so, triggering the function calling unit, and if not, triggering the circulating unit.
Preferably, the parsing type acquiring unit is specifically configured to:
and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
Preferably, the function calling unit is specifically configured to:
if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
Correspondingly, the invention also discloses an XML file analysis device which is applied to the XML file conforming to the ODX standard and comprises:
a memory for storing a computer program;
a processor for implementing the steps of the parsing method of the XML file as described above when executing the computer program.
Correspondingly, the invention also discloses a readable storage medium, wherein the readable storage medium is stored with a computer program, and the computer program realizes the steps of the XML file parsing method when being executed by a processor.
The invention discloses an XML file analysis method, which is applied to an XML file conforming to an ODX standard and comprises the following steps: step S1: positioning the position of a target label in the XML file; step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass; if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3; if the analysis class is the label class, executing a step S3; if the analysis class is the group, the position of the target label is saved and the step S4 is executed; step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag; step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing. According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating steps of an XML file parsing method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating sub-steps of a method for parsing an XML file according to an embodiment of the present application;
FIG. 3 is a structural diagram of an XML file parsing system according to an embodiment of the present application;
fig. 4 is a structural diagram of an XML document parsing apparatus according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
ODX (Open Diagnostic Data Exchange) is an open diagnostic data format that is widely used in the interaction of diagnostic data throughout the life cycle of a vehicle. At present, the latest version of ODX is 2.2.0, and the whole ODX data model is divided into layers such as ODX-D, ODX-C, ODX-V, ODX-E, ODX-FD, ODX-F, ODX-M and the like. When ODX is applied, an XML file conforming to the ODX standard is required to be analyzed according to an ODX standard rule file, so that data in the XML file is obtained; how to find the parsing method according to the ODX standard can be said to be one of the core technology and key steps of ODX application, if no parsing method or improper parsing is found, it is difficult to obtain the complex XML data, and ODX cannot be applied efficiently.
According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
The embodiment of the invention discloses an XML file analysis method, which is applied to an XML file conforming to an ODX standard, and is shown in FIG. 1, and comprises the following steps:
step S1: positioning the position of a target label in the XML file;
step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass;
if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3;
if the analysis class is the label class, executing a step S3;
if the analysis class is the group, the position of the target label is saved and the step S4 is executed;
it can be understood that the parsing classes in the XML file of the ODX standard can be classified into complex types and simple types, and can be further classified into group classes and base classes, wherein each group class includes one or more tags of the base class, and at this time, an inheritance relationship can be considered between the base class and the group class. These classifications are specified by the rules file of the ODX standard, from which we can choose a more appropriate parsing method.
Step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag;
step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing.
Because there may be multiple target sub-tags in the XML file, it needs to be looped multiple times to obtain the target sub-tags, and then call the sub-parsing function to parse. Before starting to acquire the first target sub-tag, the positioning of the first target sub-tag is the position of the current target tag, and the corresponding position is required to be acquired in the subsequent process of acquiring other target sub-tags.
The embodiment of the invention discloses an XML file analysis method which is applied to an XML file conforming to an ODX standard and comprises the following steps: step S1: positioning the position of a target label in the XML file; step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass; if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3; if the analysis class is the label class, executing a step S3; if the analysis class is the group, the position of the target label is saved and the step S4 is executed; step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag; step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing. According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
The embodiment of the invention discloses a specific XML file analysis method, and compared with the previous embodiment, the embodiment further describes and optimizes the technical scheme.
Specifically, referring to fig. 2, the step S4 specifically includes:
step S41: acquiring a current target sub-label according to the stored current position;
step S42: acquiring a type analysis class corresponding to a current target sub-label;
specifically, step S42 includes:
and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label. The name value is an assignment in a label name (name) table stored in advance in the ODX standard file.
Further, after the type analysis class corresponding to the current target sub-tag is obtained, the method specifically further includes:
it is determined whether the current target sub-tag is responsible for the current type parsing class, if yes, step S43 is performed, and if no, step S44 is performed.
Step S43: invoking a sub-parsing function of the current type parsing class to obtain a parsing class object of the current target sub-tag and storing the parsing class object;
specifically, the method further comprises the following steps: if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
It will be appreciated that the ID value is a tag attribute of the XML file, and its record is stored without re-parsing when applied in subsequent other parsing calculations.
Of course, if an ID value is also present in the target tag, the ID value and corresponding object are stored after the parsing function is called as well.
Step S44: the position of the current target sub-label is saved and steps S41-S43 are circulated until the next target sub-label is not acquired.
Correspondingly, the embodiment of the invention also discloses an XML file analysis system which is applied to an XML file conforming to the ODX standard, and the system is shown in FIG. 3 and comprises:
the positioning module 01 is used for positioning the position of the target tag in the XML file;
a judging module 02, configured to judge a class of an parsing class of the XML file, where the class includes a tag class, a group and a subclass; if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and triggering a processing module 03; if the analysis class is the label class, triggering the processing module 03; if the analysis class is the group, the position of the target label is saved and an analysis module 04 is triggered;
the processing module 03 is configured to enter the target tag and store the entered position to locate a first target sub-tag; acquiring an attribute value of the target tag;
the parsing module 04 is configured to traverse and obtain all target sub-tags, call corresponding sub-parsing functions, obtain parsing class objects of the target sub-tags, and store the parsing class objects.
According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
In some specific embodiments, the parsing module 04 specifically includes:
a sub-tag obtaining unit 041, configured to obtain a current target sub-tag according to the stored current position;
the parsing class obtaining unit 042 is configured to obtain a type parsing class corresponding to a current target sub-tag;
a function calling unit 043, configured to call a sub-resolution function of the current type resolution class, obtain a resolution class object of the current target sub-tag, and store the resolution class object;
and a circulation unit 044, configured to save the position of the current target sub-tag and trigger the sub-tag obtaining unit 041 until the next target sub-tag is not obtained.
In some specific embodiments, the parsing class acquisition unit 042 is further configured to:
and judging whether the current target sub-label is responsible for the current type analysis class, if so, triggering the function calling unit 043, and if not, triggering the circulating unit 044.
In some specific embodiments, the parsing class acquiring unit 042 is specifically configured to:
and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
In some specific embodiments, the function call unit 043 is specifically configured to:
if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
Correspondingly, the application discloses an XML file parsing device, as shown in FIG. 4, applied to an XML file conforming to the ODX standard, comprising a processor 11 and a memory 12; wherein the processor 11, when executing the computer program stored in the memory 12, performs the following steps:
step S1: positioning the position of a target label in the XML file;
step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass;
if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3;
if the analysis class is the label class, executing a step S3;
if the analysis class is the group, the position of the target label is saved and the step S4 is executed;
step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag;
step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing.
According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
In some specific embodiments, the following steps may be implemented when the processor 11 executes the computer subroutine stored in the memory 12:
step S41: acquiring a current target sub-label according to the stored current position;
step S42: acquiring a type analysis class corresponding to a current target sub-label;
step S43: invoking a sub-parsing function of the current type parsing class to obtain a parsing class object of the current target sub-tag and storing the parsing class object;
step S44: the position of the current target sub-label is saved and steps S41-S43 are circulated until the next target sub-label is not acquired.
In some specific embodiments, the following steps may be implemented when the processor 11 executes the computer subroutine stored in the memory 12: it is determined whether the current target sub-tag is responsible for the current type parsing class, if yes, step S43 is performed, and if no, step S44 is performed.
In some specific embodiments, the following steps may be implemented when the processor 11 executes the computer subroutine stored in the memory 12: and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
In some specific embodiments, the following steps may be implemented when the processor 11 executes the computer subroutine stored in the memory 12: if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
Further, the analyzing device in this embodiment may further include:
the input interface 13 is configured to acquire an externally imported computer program, store the acquired computer program in the memory 12, and also be configured to acquire various instructions and parameters transmitted by an external terminal device, and transmit the various instructions and parameters to the processor 11, so that the processor 11 uses the various instructions and parameters to develop corresponding processing. In this embodiment, the input interface 13 may specifically include, but is not limited to, a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, and the like.
And an output interface 14 for outputting various data generated by the processor 11 to a terminal device connected thereto, so that other terminal devices connected to the output interface 14 can acquire various data generated by the processor 11. In this embodiment, the output interface 14 may specifically include, but is not limited to, a USB interface, a serial interface, and the like.
And the communication unit 15 is used for establishing a remote communication connection between the analysis device and the external server so that the analysis device can mount the image file to the external server. In this embodiment, the communication unit 15 may specifically include, but is not limited to, a remote communication unit based on a wireless communication technology or a wired communication technology.
A keyboard 16 for acquiring various parameter data or instructions inputted by a user by tapping the key cap in real time.
And the display 17 is used for displaying the related information of the analysis process of the XML file in real time so as to facilitate the user to know the analysis condition of the current XML file in time.
The mouse 18 may be used to assist the user in inputting data and to simplify the user's operation.
Further, embodiments of the present application disclose a computer readable storage medium, where the computer readable storage medium includes Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. A computer readable storage medium having stored therein a computer program which when executed by a processor performs the steps of:
step S1: positioning the position of a target label in the XML file;
step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass;
if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3;
if the analysis class is the label class, executing a step S3;
if the analysis class is the group, the position of the target label is saved and the step S4 is executed;
step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag;
step S4: traversing to obtain all target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels, and storing.
According to the method and the device, the XML file is effectively analyzed by determining the analysis type of the XML and selecting the corresponding analysis function, so that the analysis speed and the analysis effect are good, and the analysis cost is reduced.
In some specific embodiments, the computer subroutine stored in the computer readable storage medium may specifically implement the following steps when executed by a processor:
step S41: acquiring a current target sub-label according to the stored current position;
step S42: acquiring a type analysis class corresponding to a current target sub-label;
step S43: invoking a sub-parsing function of the current type parsing class to obtain a parsing class object of the current target sub-tag and storing the parsing class object;
step S44: the position of the current target sub-label is saved and steps S41-S43 are circulated until the next target sub-label is not acquired.
In some specific embodiments, the computer subroutine stored in the computer readable storage medium may specifically implement the following steps when executed by a processor: it is determined whether the current target sub-tag is responsible for the current type parsing class, if yes, step S43 is performed, and if no, step S44 is performed.
In some specific embodiments, the computer subroutine stored in the computer readable storage medium may specifically implement the following steps when executed by a processor: and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
In some specific embodiments, the computer subroutine stored in the computer readable storage medium may specifically implement the following steps when executed by a processor: if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description of the method, system, device and readable storage medium for parsing XML file provided by the present invention applies specific examples to illustrate the principles and embodiments of the present invention, and the above description of the examples is only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (6)

1. The method for parsing the XML file is characterized by being applied to the XML file conforming to the ODX standard and comprising the following steps:
step S1: positioning the position of a target label in the XML file;
step S2: judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass;
if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and executing step S3;
if the analysis class is the label class, executing a step S3;
if the analysis class is the group, the position of the target label is saved and the step S4 is executed;
step S3: entering the target label and saving the entered position to locate a first target sub-label; acquiring an attribute value of the target tag;
step S4: traversing to obtain all the target sub-labels, calling corresponding sub-analysis functions, obtaining analysis class objects of the target sub-labels and storing;
the step S4 specifically includes:
step S41: acquiring a current target sub-label according to the stored current position;
step S42: acquiring a type analysis class corresponding to a current target sub-label;
step S43: invoking a sub-parsing function of the current type parsing class to obtain a parsing class object of the current target sub-tag and storing the parsing class object;
step S44: storing the position of the current target sub-label and circulating the steps S41-S43 until the next target sub-label is not acquired;
after the type analysis class corresponding to the current target sub-label is obtained, the method specifically further comprises:
it is determined whether the current target sub-tag is responsible for the current type parsing class, if yes, step S43 is performed, and if no, step S44 is performed.
2. The parsing method according to claim 1, wherein the process of obtaining the type parse class corresponding to the current target sub-tag specifically includes:
and obtaining the name of the sub-label of the current target sub-label, and comparing the name with the name value of the ODX standard file to obtain the type analysis class corresponding to the current target sub-label.
3. The parsing method according to claim 2, wherein the process of obtaining and storing the parse class object of the current target sub-label further comprises:
if the analysis class object of the current target sub-label has an ID value, the ID value and the corresponding object are stored.
4. An XML document parsing system, which is applied to an XML document conforming to the ODX standard, comprising:
the positioning module is used for positioning the position of the target tag in the XML file;
the judging module is used for judging the category of the analysis class of the XML file, wherein the category comprises a label class, a group and a subclass; if the analysis class is the subclass, calling a father analysis function corresponding to the subclass, positioning to the position of the target label, and triggering a processing module; if the analysis class is the label class, triggering the processing module; if the analysis class is the group, the position of the target label is saved and an analysis module is triggered;
the processing module is used for entering the target label and storing the position after entering so as to position a first target sub-label; acquiring an attribute value of the target tag;
the analysis module is used for traversing and acquiring all target sub-labels, calling corresponding sub-analysis functions, acquiring analysis class objects of the target sub-labels and storing the analysis class objects;
the analysis module specifically comprises:
the sub-tag obtaining unit is used for obtaining a current target sub-tag according to the stored current position;
the analysis class acquisition unit is used for acquiring a type analysis class corresponding to the current target sub-label;
the function calling unit is used for calling the sub-analysis function of the current type analysis class, obtaining the analysis class object of the current target sub-label and storing the analysis class object;
the circulation unit is used for storing the position of the current target sub-label and triggering the sub-label acquisition unit until the next target sub-label is not acquired;
the parsing class acquisition unit is further configured to:
and judging whether the current target sub-label is responsible for the current type analysis class, if so, triggering the function calling unit, and if not, triggering the circulating unit.
5. An XML file parsing apparatus, which is applied to an XML file conforming to the ODX standard, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method for parsing an XML file according to any one of claims 1 to 3 when executing the computer program.
6. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method of parsing an XML file according to any one of claims 1 to 3.
CN201811626079.3A 2018-12-28 2018-12-28 XML file analysis method, system, device and readable storage medium Active CN109710808B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811626079.3A CN109710808B (en) 2018-12-28 2018-12-28 XML file analysis method, system, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811626079.3A CN109710808B (en) 2018-12-28 2018-12-28 XML file analysis method, system, device and readable storage medium

Publications (2)

Publication Number Publication Date
CN109710808A CN109710808A (en) 2019-05-03
CN109710808B true CN109710808B (en) 2023-04-28

Family

ID=66259172

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811626079.3A Active CN109710808B (en) 2018-12-28 2018-12-28 XML file analysis method, system, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN109710808B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930097B (en) * 2020-07-28 2021-12-07 深圳市元征科技股份有限公司 Vehicle diagnostic data analysis method, device, equipment and storage medium
CN112445797B (en) * 2020-11-13 2023-09-05 深圳市元征科技股份有限公司 Vehicle diagnosis data reference method, device, terminal equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944080A (en) * 2010-09-02 2011-01-12 北京科技大学 Method for reading and XML conversion based on DXF file format
WO2013135055A1 (en) * 2012-03-15 2013-09-19 北京播思无线技术有限公司 Method for storing xml data into relational database
CN108255494A (en) * 2018-01-30 2018-07-06 平安科技(深圳)有限公司 A kind of XML file analytic method, device, computer equipment and storage medium
CN108509658A (en) * 2018-04-28 2018-09-07 中国联合网络通信集团有限公司 A kind of analysis method and device of XML file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944080A (en) * 2010-09-02 2011-01-12 北京科技大学 Method for reading and XML conversion based on DXF file format
WO2013135055A1 (en) * 2012-03-15 2013-09-19 北京播思无线技术有限公司 Method for storing xml data into relational database
CN108255494A (en) * 2018-01-30 2018-07-06 平安科技(深圳)有限公司 A kind of XML file analytic method, device, computer equipment and storage medium
CN108509658A (en) * 2018-04-28 2018-09-07 中国联合网络通信集团有限公司 A kind of analysis method and device of XML file

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XML解析方式对比与分析;赖武定;《电脑编程技巧与维护》;20100418(第08期);全文 *

Also Published As

Publication number Publication date
CN109710808A (en) 2019-05-03

Similar Documents

Publication Publication Date Title
CN108984388B (en) Method and terminal equipment for generating automatic test case
CN107622080B (en) Data processing method and equipment
CN109710808B (en) XML file analysis method, system, device and readable storage medium
CN110221959B (en) Application program testing method, device and computer readable medium
US10467262B2 (en) Customized visualization based intelligence augmentation
CN110245681A (en) Model generating method, application interface method for detecting abnormality, device, terminal device and computer readable storage medium
CN112083919B (en) Target service code generation method and device based on YAML template
CN111324352A (en) Code generation method of application page and related equipment
CN109189395B (en) Data analysis method and device
CN109240664B (en) Method and terminal for collecting user behavior information
CN105959469B (en) Short message display method, display device and terminal
US20170243228A1 (en) Screen-image based classification
CN111563380A (en) Named entity identification method and device
CN110489032B (en) Dictionary query method for electronic book and electronic equipment
CN114579203A (en) Script file checking method and device, electronic equipment and storage medium
CN112329409B (en) Cell color conversion method and device and electronic equipment
CN112052157B (en) Method, device and system for constructing test message
CN109358919B (en) Dynamic configuration method and device for universal page, computer equipment and storage medium
CN109063561B (en) Formula identification calculation method and device
CN113449067A (en) Data query method, device, equipment and medium
CN112416500B (en) Information processing method and electronic equipment
CN111753548A (en) Information acquisition method and device, computer storage medium and electronic equipment
CN112597186A (en) Data query method, computer equipment and storage medium
CN112988986A (en) Man-machine interaction method, device and equipment
CN110209934A (en) Information-pushing method and relevant apparatus based on micro- Expression Recognition

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