CN103500169B - File comparison device and file comparison method - Google Patents

File comparison device and file comparison method Download PDF

Info

Publication number
CN103500169B
CN103500169B CN201310392155.XA CN201310392155A CN103500169B CN 103500169 B CN103500169 B CN 103500169B CN 201310392155 A CN201310392155 A CN 201310392155A CN 103500169 B CN103500169 B CN 103500169B
Authority
CN
China
Prior art keywords
file
comparison unit
contrasted
arbitrary
node
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
CN201310392155.XA
Other languages
Chinese (zh)
Other versions
CN103500169A (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.)
Yonyou Network Technology Co Ltd
Original Assignee
Yonyou Network 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 Yonyou Network Technology Co Ltd filed Critical Yonyou Network Technology Co Ltd
Priority to CN201310392155.XA priority Critical patent/CN103500169B/en
Publication of CN103500169A publication Critical patent/CN103500169A/en
Application granted granted Critical
Publication of CN103500169B publication Critical patent/CN103500169B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML

Landscapes

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

Abstract

The invention provides a file comparison device and file comparison method. The file comparison device comprises an element node selection module, an analysis file configuration module, a file analysis module and a file comparison module. The element node selection module is used for selecting at least one element node to be compared from at least one file containing element nodes. The analysis file configuration module is used for configuring an analysis file for analyzing at least one file according to the name of the at least one element node to be compared selected by the element node selection module and the keyword information of each element node to be compared. The file analysis module is used for analyzing each file in the at least one file according to the analysis file to obtain at least one comparison unit of each file. The file comparison module is used for comparing each file with other files in the at least one file through the at least one comparison unit of each file. By means of the technical scheme, file comparison can be located into comparison of the element nodes in the file, and thus the accuracy of a comparison result is improved.

Description

File contrast device and file control methods
Technical field
The present invention relates to field of computer technology, contrast device and a kind of contrast of file in particular to a kind of file Method.
Background technology
Extensible markup language (Extensible Markup Language, XML) is a kind of for labelling e-file Make it have structural markup language, can be used to flag data, define data type, and allow the mark to oneself for the user Note language is defined.XML language is widely used in data storage and exchange, such as common configuration file, is all with XML side Formula is stored.XML language is also applied to the technology such as Java Message Service and Web Services as data Exchange.
XML language is most important for system, but, carry out disposing, upgrade, occur abnormal or running in system During, if the content of XML language changes, developer and guardian need to check substantial amounts of XML configuration file and Difference before and after change for the corresponding data file, workload is huge.Common file contrast instrument, can only be contrasted by row, The difference of XML file can not accurately be contrasted.As shown in figure 1, two XML file be back end position different, but It is all variant that file contrast instrument will report two back end by mistake.
Therefore, the accuracy how improving XML file comparing result becomes technical problem urgently to be resolved hurrily.
Content of the invention
The present invention is based on above-mentioned technical problem it is proposed that a kind of new file contrasts scheme, can be right by file The ratio contrast navigating to node element in file, improves the accuracy of comparing result.
In view of this, the present invention proposes a kind of file contrast device, including:Node element selecting module, for At least one node element to be contrasted is selected in a few file comprising node element;Resolution file configuration module, is used for The title of at least one node element to be contrasted according to described node element selecting module selects, and described in each The keyword message of node element to be contrasted, is configured to parse the resolution file of at least one file described;Document analysis Module, for according to described resolution file, parsing to each file at least one file described, obtain described each At least one comparison unit of file;File contrast module, for being incited somebody to action by least one comparison unit of each file described Each file described is contrasted with the alternative document at least one file described.
In this technical scheme, the configuration file that the node element to be contrasted according to selecting generates, element will be comprised At least one document analysis of node be comparison unit, by the comparison unit in each file by each file and at least one Alternative document in file is contrasted, and file can be made when being contrasted, navigate to the contrast of node element, in other words Say, if content in two files for one of node element is the same, simply position is different, existing contrast instrument Can be reported an error, but because this technical scheme has navigated to the contrast of node element, therefore, as long as node element is in two literary compositions Content in part is the same, and even position is different also will not be reported an error, and improves the accuracy of file contrast.
At least one node element to be contrasted selecting wherein from the file that at least one comprises node element is permissible It is to select in wherein one or more files from least one file, and one can also be selected from each file Or multiple node element to be contrasted, ratio, if any three files, contains three node elements, then selects in each file Node element can be to select one or more node elements in each file from three files it is also possible to simply from one Select one or more node elements in individual file, one or more node elements can also be selected from two files respectively.
Keyword message due to node element can carry out unique mark to node element, therefore according to specified element section The title of point and the resolution file of the keyword message configuration of this specified node element, can will comprise this specified node element In file, corresponding node element resolves to comparison unit, if not comprising the node element that this specifies in this document, will not solve Separate out the corresponding comparison unit of this specified node element.
It is preferable that also including in technique scheme:Judge module 210, for the arbitrary contrast list to arbitrary file The keyword message whether comprising arbitrary described node element to be contrasted in unit is judged, is judging described arbitrary file When comprising arbitrary described keyword message wait the node element contrasting in arbitrary comparison unit, described arbitrary comparison unit is added Enter in the list to be contrasted of described arbitrary file;Described file contrast module, be additionally operable to according to each file described wait contrast Each file described is contrasted by the comparison unit in list with the alternative document at least one file described.
In this technical scheme, the node element in file may comprise child element node and attribute node, in parsing The comparison unit occurring afterwards(Child element node or the corresponding comparison unit of attribute node)In, may not there is keyword letter Breath, is not individually compared for this comparison unit that there is not keyword message, only to its superior node(I.e. daughter element section Point or the immediate superior node of attribute node)Corresponding comparison unit is contrasted.
It is preferable that described file contrast module includes in technique scheme:Comparison unit selecting module and lookup mould Block, wherein, described comparison unit selecting module, for selecting to specify contrast from list to be contrasted described in described arbitrary file Unit;Described searching modul, for according to the described keyword message in described specified comparison unit from described at least one literary composition The comparison unit comprising described keyword message is searched in arbitrary alternative document in part;Described file contrast module, is additionally operable to When described searching modul finds, from described arbitrary alternative document, the comparison unit comprising described keyword message, will be described Specified comparison unit is contrasted with the described comparison unit finding;Or in described searching modul from described arbitrary alternative document In when not finding the comparison unit comprising described keyword message, judge in described arbitrary alternative document, not comprising described specifying Comparison unit.
In this technical scheme, contain the keyword message of respective element node in comparison unit, and keyword message Corresponding node element uniquely can be identified, therefore by specifying the keyword message in comparison unit, from other Search, in file, the comparison unit comprising this keyword message, it is right to carry out the content of identity element node in different files Ratio, due to the contrast of file navigating to the contrast of node element, therefore improves the accuracy of comparing result.
And pass through to set up list to be contrasted, and the comparison unit comprising keyword message is added in list to be contrasted, permissible When being contrasted, from list to be contrasted, easily search corresponding comparison unit contrasted, it is to avoid from multiple arrangements Search corresponding comparison unit in comparison unit that is chaotic and/or not comprising keyword, reduce and search corresponding comparison unit Time, thus shorten the time that comparison unit is contrasted.
It is preferable that also including in technique scheme:Display module, for will be described in described file contrast module All comparison units in list to be contrasted described in arbitrary file all with corresponding comparison unit in described arbitrary alternative document After being contrasted, the comparing result of described arbitrary file and described arbitrary alternative document is shown according to default order Show.
In this technical scheme, by being shown the comparing result of file by preset order, file can be made to contrast Visual result present to user and checked, in order to the follow-up operation of user.Preferably, default order is wherein one The order of multiple node element arrangements in individual file, such as, node element Widget is arranged in node element in one file Before View, then, in display comparison result, the comparing result of node element Widget is shown in the right of node element View Before result.Simultaneously as having navigated to the contrast of node element in comparison process, thus it is shown that comparing result also no Need to manually be analyzed, it is to avoid contrasted by row, then by exploitation, attendant, comparing result is analyzed, decrease Exploitation, the workload of attendant.
It is preferable that described file is XML file in technique scheme.
In this technical scheme, because XML language is of many uses, the title of node element and its keyword message can be certainly Definition is configured, hence in so that this technical scheme can meet extensible markup language (Extensible Markup to all Language, XML) file of specification can be carried out relative analyses.During relative analyses, it is to avoid due to element section The problem that the order of point, level are different and wrong report mistake, simultaneously because XML file is structural data, therefore output is right Can be as accurate as specific object and the property value of node element than result.
According to a further aspect in the invention it is also proposed that a kind of file control methods, including:Step 302, from least one At least one node element to be contrasted is selected in the file comprising node element;Step 304, at least one according to select The title of individual node element to be contrasted, and the keyword message of node element to be contrasted described in each, are configured to solve The resolution file of analysis at least one file described;Step 306, according to described resolution file, at least one file described Each file is parsed, and obtains at least one comparison unit of each file described;Step 308, by each file described At least one comparison unit each file described is contrasted with the alternative document at least one file described.
In this technical scheme, the configuration file that the node element to be contrasted according to selecting generates, element will be comprised At least one document analysis of node be comparison unit, by the comparison unit in each file by each file and at least one Alternative document in file is contrasted, and file can be made when being contrasted, navigate to the contrast of node element, in other words Say, if content in two files for one of node element is the same, simply position is different, existing contrast instrument Can be reported an error, but because this technical scheme has navigated to the contrast of node element, therefore, as long as node element is in two literary compositions Content in part is the same, and even position is different also will not be reported an error, and improves the accuracy of file contrast.
At least one node element to be contrasted selecting wherein from the file that at least one comprises node element is permissible It is to select in wherein one or more files from least one file, and one can also be selected from each file Or multiple node element to be contrasted, ratio, if any three files, contains three node elements, then selects in each file Node element can be to select one or more node elements in each file from three files it is also possible to simply from one Select one or more node elements in individual file, one or more node elements can also be selected from two files respectively.
Keyword message due to node element can carry out unique mark to node element, therefore according to specified element section The title of point and the resolution file of the keyword message configuration of this specified node element, can will comprise this specified node element In file, corresponding node element resolves to comparison unit, if not comprising the node element that this specifies in this document, will not solve Separate out the corresponding comparison unit of this specified node element.
It is preferable that described step 308 also includes in technique scheme:In the arbitrary contrast list judging arbitrary file When comprising arbitrary described keyword message wait the node element contrasting in unit, will be described arbitrary for described arbitrary comparison unit addition In the list to be contrasted of file;According to the comparison unit in the list to be contrasted of each file described by each file described and institute The alternative document stated at least one file is contrasted.
In this technical scheme, the node element in file may comprise child element node and attribute node, in parsing The comparison unit occurring afterwards(Child element node or the corresponding comparison unit of attribute node)In, may not there is keyword letter Breath, is not individually compared for this comparison unit that there is not keyword message, only to its superior node(I.e. daughter element section Point or the immediate superior node of attribute node)Corresponding comparison unit is contrasted.
It is preferable that described step 308 is specially in technique scheme:From waiting to contrast described in described arbitrary file Select in list to specify comparison unit, according to the described keyword message in described specified comparison unit from least one literary composition described The comparison unit comprising described keyword message is searched in arbitrary alternative document in part;If looking in described arbitrary alternative document Find the comparison unit comprising described keyword message, then described specified comparison unit is entered with the described comparison unit finding Row contrast;If not finding the comparison unit comprising described keyword message in described arbitrary alternative document, judge described Described specified comparison unit is not comprised in arbitrary alternative document.
In this technical scheme, contain the keyword message of respective element node in comparison unit, and keyword message Corresponding node element uniquely can be identified, therefore by specifying the keyword message in comparison unit, from other Search, in file, the comparison unit comprising this keyword message, it is right to carry out the content of identity element node in different files Ratio, due to the contrast of file navigating to the contrast of node element, therefore improves the accuracy of comparing result.
And pass through to set up list to be contrasted, and the comparison unit comprising keyword message is added in list to be contrasted, permissible When being contrasted, from list to be contrasted, easily search corresponding comparison unit contrasted, it is to avoid from multiple arrangements Search corresponding comparison unit in comparison unit that is chaotic and/or not comprising keyword, reduce and search corresponding comparison unit Time, thus shorten the time that comparison unit is contrasted.
It is preferable that after described step 308, also including in technique scheme:Described in described arbitrary file After all comparison units in list to be contrasted all are contrasted with corresponding comparison unit in described arbitrary alternative document, will Described arbitrary file is shown according to default order with the comparing result of described arbitrary alternative document.
In this technical scheme, by being shown the comparing result of file by preset order, file can be made to contrast Visual result present to user and checked, in order to the follow-up operation of user.Preferably, default order is wherein one The order of multiple node element arrangements in individual file, such as, node element Widget is arranged in node element in one file Before View, then, in display comparison result, the comparing result of node element Widget is shown in the right of node element View Before result.Simultaneously as having navigated to the contrast of node element in comparison process, thus it is shown that comparing result also no Need to manually be analyzed, it is to avoid contrasted by row, then by exploitation, attendant, comparing result is analyzed, decrease Exploitation, the workload of attendant.
It is preferable that described file is XML file in technique scheme.
In this technical scheme, because XML language is of many uses, the title of node element and its keyword message can be certainly Definition is configured, hence in so that this technical scheme can meet extensible markup language (Extensible Markup to all Language, XML) file of specification can be carried out relative analyses.During relative analyses, it is to avoid due to element section The problem that the order of point, level are different and wrong report mistake, simultaneously because XML file is structural data, therefore output is right Can be as accurate as specific object and the property value of node element than result.
By above technical scheme, the contrast of file can be navigated to the contrast of node element in file, it is right to improve Accuracy than result.
Brief description
Fig. 1 shows the result schematic diagram of file contrast in correlation technique;
Fig. 2 shows the schematic block diagram of file contrast device according to an embodiment of the invention;
Fig. 3 shows the schematic flow diagram of file control methods according to an embodiment of the invention;
Fig. 4 shows the schematic flow diagram of document analysis method according to an embodiment of the invention;
Fig. 5 shows the schematic flow diagram of file control methods according to an embodiment of the invention;
Fig. 6 shows the schematic diagram of option and installment file according to another embodiment of the invention;
Fig. 7 shows the content schematic diagram of comparison unit according to another embodiment of the invention;
Fig. 8 show document analysis according to another embodiment of the invention after comparison unit structural representation Figure;
The structure of comparison unit after Fig. 9 shows another document analysis according to another embodiment of the invention is shown It is intended to;
Figure 10 show document analysis according to another embodiment of the invention after comparison unit another kind Structural representation;
Figure 11 show another document analysis according to another embodiment of the invention after comparison unit another Plant structural representation;
Figure 12 shows comparing result schematic diagram according to another embodiment of the invention.
Specific embodiment
In order to be more clearly understood that the above objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specifically real Mode of applying is further described in detail to the present invention.It should be noted that in the case of not conflicting, the enforcement of the application Feature in example and embodiment can be mutually combined.
Elaborate a lot of details in the following description in order to fully understand the present invention, but, the present invention also may be used To be implemented different from other modes described here using other, therefore, protection scope of the present invention is not described below Specific embodiment restriction.
Fig. 2 shows the schematic block diagram of file contrast device according to an embodiment of the invention.
As shown in Fig. 2 file contrasts device 200 according to an embodiment of the invention, including:Node element selecting module 202, for comprise node element from least one file in select at least one node element to be contrasted;Resolution file is joined Put module 204, at least one node element to be contrasted according to the selection of described node element selecting module 202 Title, and the keyword message of node element to be contrasted described in each, are configured to parse at least one file described Resolution file;Document analysis module 206, for according to described resolution file, to each file at least one file described Parsed, obtained at least one comparison unit of each file described;File contrast module 208, for by described each Each file described is contrasted by least one comparison unit of file with the alternative document at least one file described.
In this technical scheme, the configuration file that the node element to be contrasted according to selecting generates, element will be comprised At least one document analysis of node be comparison unit, by the comparison unit in each file by each file and at least one Alternative document in file is contrasted, and file can be made when being contrasted, navigate to the contrast of node element, in other words Say, if content in two files for one of node element is the same, simply position is different, existing contrast instrument Can be reported an error, but because this technical scheme has navigated to the contrast of node element, therefore, as long as node element is in two literary compositions Content in part is the same, and even position is different also will not be reported an error, and improves the accuracy of file contrast.
At least one node element to be contrasted selecting wherein from the file that at least one comprises node element is permissible It is to select in wherein one or more files from least one file, and one can also be selected from each file Or multiple node element to be contrasted, ratio, if any three files, contains three node elements, then selects in each file Node element can be to select one or more node elements in each file from three files it is also possible to simply from one Select one or more node elements in individual file, one or more node elements can also be selected from two files respectively.
Keyword message due to node element can carry out unique mark to node element, therefore according to specified element section The title of point and the resolution file of the keyword message configuration of this specified node element, can will comprise this specified node element In file, corresponding node element resolves to comparison unit, if not comprising the node element that this specifies in this document, will not solve Separate out the corresponding comparison unit of this specified node element.
It is preferable that also including in technique scheme:Judge module 210, for the arbitrary contrast list to arbitrary file The keyword message whether comprising arbitrary described node element to be contrasted in unit is judged, is judging described arbitrary file When comprising arbitrary described keyword message wait the node element contrasting in arbitrary comparison unit, described arbitrary comparison unit is added Enter in the list to be contrasted of described arbitrary file;Described file contrast module 208, be additionally operable to according to each file described treat right Than the comparison unit in list, each file described is contrasted with the alternative document at least one file described.
In this technical scheme, the node element in file may comprise child element node and attribute node, in parsing The comparison unit occurring afterwards(Child element node or the corresponding comparison unit of attribute node)In, may not there is keyword letter Breath, is not individually compared for this comparison unit that there is not keyword message, only to its superior node(I.e. daughter element section Point or the immediate superior node of attribute node)Corresponding comparison unit is contrasted.
It is preferable that described file contrast module 208 includes in technique scheme:Comparison unit selecting module 2082 With searching modul 2084, wherein, described comparison unit selecting module 2082, for from treat described in described arbitrary file contrast row Select in table to specify comparison unit;Described searching modul 2084, for according to the described keyword in described specified comparison unit The comparison unit comprising described keyword message is searched in arbitrary alternative document from least one file described for the information;Described File contrast module 208, is additionally operable to find from described arbitrary alternative document in described searching modul 2084 and comprises described pass During the comparison unit of key word information, described specified comparison unit is contrasted with the described comparison unit finding;Or institute When stating searching modul 2084 and not finding, from described arbitrary alternative document, the comparison unit comprising described keyword message, judge Described specified comparison unit is not comprised in described arbitrary alternative document.
In this technical scheme, contain the keyword message of respective element node in comparison unit, and keyword message Corresponding node element uniquely can be identified, therefore by specifying the keyword message in comparison unit, from other Search, in file, the comparison unit comprising this keyword message, it is right to carry out the content of identity element node in different files Ratio, due to the contrast of file navigating to the contrast of node element, therefore improves the accuracy of comparing result.
And pass through to set up list to be contrasted, and the comparison unit comprising keyword message is added in list to be contrasted, permissible When being contrasted, from list to be contrasted, easily search corresponding comparison unit contrasted, it is to avoid from multiple arrangements Search corresponding comparison unit in comparison unit that is chaotic and/or not comprising keyword, reduce and search corresponding comparison unit Time, thus shorten the time that comparison unit is contrasted.
It is preferable that also including in technique scheme:Display module 212, in described file contrast module 208 All comparison units in list to be contrasted described in described arbitrary file are all corresponding right with described arbitrary alternative document After being contrasted than unit, the comparing result of described arbitrary file and described arbitrary alternative document is entered according to default order Row display.
In this technical scheme, by being shown the comparing result of file by preset order, file can be made to contrast Visual result present to user and checked, in order to the follow-up operation of user.Preferably, default order is wherein one The order of multiple node element arrangements in individual file, such as, node element Widget is arranged in node element in one file Before View, then, in display comparison result, the comparing result of node element Widget is shown in the right of node element View Before result.Simultaneously as having navigated to the contrast of node element in comparison process, thus it is shown that comparing result also no Need to manually be analyzed, it is to avoid contrasted by row, then by exploitation, attendant, comparing result is analyzed, decrease Exploitation, the workload of attendant.
It is preferable that described file is XML file in technique scheme.
In this technical scheme, because XML language is of many uses, the title of node element and its keyword message can be certainly Definition is configured, hence in so that this technical scheme can meet extensible markup language (Extensible Markup to all Language, XML) file of specification can be carried out relative analyses.During relative analyses, it is to avoid due to element section The problem that the order of point, level are different and wrong report mistake, simultaneously because XML file is structural data, therefore output is right Can be as accurate as specific object and the property value of node element than result.
Fig. 3 shows the schematic flow diagram of file control methods according to an embodiment of the invention.
As described in Figure 3, file control methods according to an embodiment of the invention, including:Step 302, from least one bag At least one node element to be contrasted is selected in file containing node element;Step 304, according to select described at least one The title of node element to be contrasted, and the keyword message of node element to be contrasted described in each, are configured to parse The resolution file of at least one file described;Step 306, according to described resolution file, to every at least one file described Individual file is parsed, and obtains at least one comparison unit of each file described;Step 308, by each file described Each file described is contrasted by least one comparison unit with the alternative document at least one file described.
In this technical scheme, the configuration file that the node element to be contrasted according to selecting generates, element will be comprised At least one document analysis of node be comparison unit, by the comparison unit in each file by each file and at least one Alternative document in file is contrasted, and file can be made when being contrasted, navigate to the contrast of node element, in other words Say, if content in two files for one of node element is the same, simply position is different, existing contrast instrument Can be reported an error, but because this technical scheme has navigated to the contrast of node element, therefore, as long as node element is in two literary compositions Content in part is the same, and even position is different also will not be reported an error, and improves the accuracy of file contrast.
At least one node element to be contrasted selecting wherein from the file that at least one comprises node element is permissible It is to select in wherein one or more files from least one file, and one can also be selected from each file Or multiple node element to be contrasted, ratio, if any three files, contains three node elements, then selects in each file Node element can be to select one or more node elements in each file from three files it is also possible to simply from one Select one or more node elements in individual file, one or more node elements can also be selected from two files respectively.
Keyword message due to node element can carry out unique mark to node element, therefore according to specified element section The title of point and the resolution file of the keyword message configuration of this specified node element, can will comprise this specified node element In file, corresponding node element resolves to comparison unit, if not comprising the node element that this specifies in this document, will not solve Separate out the corresponding comparison unit of this specified node element.
It is preferable that described step 308 also includes in technique scheme:In the arbitrary contrast list judging arbitrary file When comprising arbitrary described keyword message wait the node element contrasting in unit, will be described arbitrary for described arbitrary comparison unit addition In the list to be contrasted of file;According to the comparison unit in the list to be contrasted of each file described by each file described and institute The alternative document stated at least one file is contrasted.
In this technical scheme, the node element in file may comprise child element node and attribute node, in parsing The comparison unit occurring afterwards(Child element node or the corresponding comparison unit of attribute node)In, may not there is keyword letter Breath, is not individually compared for this comparison unit that there is not keyword message, only to its superior node(I.e. daughter element section Point or the immediate superior node of attribute node)Corresponding comparison unit is contrasted.
It is preferable that described step 308 is specially in technique scheme:From waiting to contrast described in described arbitrary file Select in list to specify comparison unit, according to the described keyword message in described specified comparison unit from least one literary composition described The comparison unit comprising described keyword message is searched in arbitrary alternative document in part;If looking in described arbitrary alternative document Find the comparison unit comprising described keyword message, then described specified comparison unit is entered with the described comparison unit finding Row contrast;If not finding the comparison unit comprising described keyword message in described arbitrary alternative document, judge described Described specified comparison unit is not comprised in arbitrary alternative document.
In this technical scheme, contain the keyword message of respective element node in comparison unit, and keyword message Corresponding node element uniquely can be identified, therefore by specifying the keyword message in comparison unit, from other Search, in file, the comparison unit comprising this keyword message, it is right to carry out the content of identity element node in different files Ratio, due to the contrast of file navigating to the contrast of node element, therefore improves the accuracy of comparing result.
And pass through to set up list to be contrasted, and the comparison unit comprising keyword message is added in list to be contrasted, permissible When being contrasted, from list to be contrasted, easily search corresponding comparison unit contrasted, it is to avoid from multiple arrangements Search corresponding comparison unit in comparison unit that is chaotic and/or not comprising keyword, reduce and search corresponding comparison unit Time, thus shorten the time that comparison unit is contrasted.
It is preferable that after described step 308, also including in technique scheme:Described in described arbitrary file After all comparison units in list to be contrasted all are contrasted with corresponding comparison unit in described arbitrary alternative document, will Described arbitrary file is shown according to default order with the comparing result of described arbitrary alternative document.
In this technical scheme, by being shown the comparing result of file by preset order, file can be made to contrast Visual result present to user and checked, in order to the follow-up operation of user.Preferably, default order is wherein one The order of multiple node element arrangements in individual file, such as, node element Widget is arranged in node element in one file Before View, then, in display comparison result, the comparing result of node element Widget is shown in the right of node element View Before result.Simultaneously as having navigated to the contrast of node element in comparison process, thus it is shown that comparing result also no Need to manually be analyzed, it is to avoid contrasted by row, then by exploitation, attendant, comparing result is analyzed, decrease Exploitation, the workload of attendant.
It is preferable that described file is XML file in technique scheme.
In this technical scheme, because XML language is of many uses, the title of node element and its keyword message can be certainly Definition is configured, hence in so that this technical scheme can meet extensible markup language (Extensible Markup to all Language, XML) file of specification can be carried out relative analyses.During relative analyses, it is to avoid due to element section The problem that the order of point, level are different and wrong report mistake, simultaneously because XML file is structural data, therefore output is right Can be as accurate as specific object and the property value of node element than result.
Fig. 4 shows the schematic flow diagram of document analysis method according to an embodiment of the invention.
As shown in figure 4, document analysis method according to an embodiment of the invention, including:
Step 402, obtains resolution file, and resolution file is according to the element choosing from the file of pending contrast The title of node, and the keyword message configuration of node element, in order to parse the file of pending contrast.
Step 404, resolution file 1, according to resolution file, the file 1 of pending contrast is parsed.
Step 406, the node element in resolution file 1 creates comparison unit, and the resolution file according to configuration is by file 1 Corresponding node element resolves to comparison unit.
Step 408, obtains the content in comparison unit.
Step 410, judges whether the content in comparison unit comprises keyword message, if comprising keyword message, holds Row step 412, otherwise, execution step 416.Because the node element in file may comprise child element node and attribute node, The comparison unit occurring after parsing(Child element node or the corresponding comparison unit of attribute node)In, may not there is pass Key word information, is not individually compared for this comparison unit that there is not keyword message, only to its superior node(I.e. son The immediate superior node of node element or attribute node)Corresponding comparison unit is contrasted.
Step 412, judges whether the keyword message obtaining is unique, if so, then execution step 414, otherwise, execution Step 416.Keyword message can carry out unique mark to node element, when the keyword message that determination obtains is unique, can To be contrasted it is generally the case that the keyword message of different node element differing to this node element, therefore in element When the keyword message of node differs, this step can not be judged.
Step 414, when decision element node has keyword and keyword is unique, current comparison unit is put into and treats In contrast list.
Step 416, when decision element node does not have keyword and/or keyword is not unique, will currently contrast list The corresponding node of unit is put in its immediate superior node and is contrasted.
Step 418, judges whether the corresponding node element of comparison unit of selection comprises child element node or attribute node, If so, then execution step 420, otherwise, execution step 424.
Step 420, traversal child element node and/or attribute node, judging whether can be by this node element and/or attribute The corresponding comparison unit of node is put in list to be contrasted.
Step 422, obtains the comparison unit set of file 1, deposits in list to be contrasted.
Obtain the comparison unit set of file 2 according to identical method.
Describe the file contrast scheme of the present invention with reference to Fig. 5 in detail.
Fig. 5 shows the schematic flow diagram of file control methods according to an embodiment of the invention.
As shown in figure 5, file control methods according to an embodiment of the invention, including:
Step 502, selects to specify comparison unit from the list to be contrasted of file 1.
Step 504, searches from the list to be contrasted of file 2 according to the keyword message in this specified comparison unit and has The comparison unit of same keyword information.
Step 506, the comparison unit finding and from file 2 this execution comparison unit is contrasted, and contrasts content Including the daughter element comprising, the attribute information of daughter element, the attribute information of itself, content of text etc..
Step 508, after this specified comparison unit is completed with the comparison unit contrast finding from file 2, output Comparing result.
Step 510, judges whether also have the comparison unit being contrasted in the list to be contrasted of file 1, if so, then returns Return step 502, otherwise, execution step 512.
Step 512, the comparing result of output file 1 and file 2.
Fig. 4 to Fig. 5 illustrates the document analysis method and file control methods during two files, certainly, the application In document analysis method and file control methods can expand to the situation of multiple files, for multiple files carry out parsing with The method of contrast, also should be within the protection domain of the application.
Describe the technical scheme of an alternative embodiment of the invention with reference to Fig. 6 to Figure 12 in detail.
In the present embodiment, taking the control methods of two files as a example it is illustrated, but those skilled in the art should Understand, the document analysis method in the application and file control methods can expand to the situation of multiple files, for multiple literary compositions The method that part is parsed and contrasted, also should be within the protection domain of the application.
Before file is contrasted, need, according to the node element Command Line Parsing file selected from file, joining When putting resolution file, often row describes a node element, and form is:Node element title=keyword message, as follows, fixed Three node elements of justice:
Widget=pk
View=key
Default=id
Wherein, resolution file can save as * .ini form or the file of * .xml form.
As shown in fig. 6, when file is contrasted it is intended that resolution file, the literary composition that needs contrasted by resolution file Part resolves to comparison unit.Wherein, first representation of file file 1 in Fig. 6, second representation of file file 2.
The form of comparison unit content is as shown in fig. 7, the information that represents respectively of content therein is as follows:
Path:Represent element path;
Id:Represent element key;
Parent:Represent father's element of this node element(I.e. superior node);
Childs:Represent the daughter element of this node element(I.e. downstream site);
Nodetype:Represent element type, wherein element represents node type, and attribute represents nodal community class Type;
Havekey:Indicate whether keyword;
Content:Represent the content of node element, if nodetype=element, representing content is element bag The content of text containing, if nodetype=attribute, representing content is property value.
For file 2, introduce in detail below:
The content of file 2 is as follows:
Wherein, Widget is a node element, and it has key attribute pk, is worth for mainView, has attribute node CanFreeDesign, and have two child element node View_mainquery and View_ with keyword confidence mainquery2.Obtain comparison unit after resolution file parsing as shown in figure 8, wherein attribute node The corresponding comparison unit of canFreeDesign, due to not comprising keyword message, is not therefore contrasted.
For file 1, introduce in detail below:
The content of file 1 is as follows:
Wherein, Widget is a node element, and it has key attribute pk, is worth for mainView, has attribute node CanFreeDesign, and have three child element node View_mainquery, View_mainquery2 with keyword confidence And Componet_label1, wherein, child element node View_mainquery2 also has child element node Label.Through solution Comparison unit is obtained as shown in Figure 9 after analysis document analysis.
According to the parsing to file 1 and file 2, obtain the comparison unit figure of two tree structures, contrast root node first, Output comparing result, the then child node of all same keyword of recursive traversal successively again, without keyword, then in order The node of traversal same names, exports comparing result.
In some XML file, the keyword message of node element can be unique in file, and relative analyses result Can also be unrelated with the structural path of XML, therefore file 2 can generate comparison unit figure as shown in Figure 10, and file 1 can be given birth to Become comparison unit figure as shown in figure 11.When being contrasted, the corresponding comparison unit of node element with keyword is permissible Directly it is compared and compares, no the node element of keyword and/or attribute node are with father's element(I.e. immediate superior node)Carry out Relatively, individually do not contrasted.
After the comparison unit of file 1 and file 2 is contrasted, obtain following comparing result:
The attribute canFreeDesign=false of node element Widget_mainView in file 2, element section in file 1 The attribute canFreeDesign=true of point Widget_mainView;
Node element View_mainquery2 in file 1 has child element node Label, no child element node in file 2 Label;
Node element View_mainquery no text node in file 1, node element View_mainquery in file 2 Text node=3333.
The image conversion of comparing result is shown as shown in figure 12, and user can immediately arrive at file 1 and file 2 by browsing Difference, and manual analyses need not be carried out.
Technical scheme is described in detail above in association with accompanying drawing it is contemplated that in the related, between file Contrast is simply contrasted by row, if being the change of location of content in file, the situation of wrong report also occurs.Therefore, originally Invention proposes a kind of new file contrast scheme, the contrast of file can navigate to the contrast of node element in file, carry The high accuracy of comparing result, and need not manually be analyzed, decrease the workload of exploitation, attendant.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for the skill of this area For art personnel, the present invention can have various modifications and variations.All within the spirit and principles in the present invention, made any repair Change, equivalent, improvement etc., should be included within the scope of the present invention.

Claims (10)

1. a kind of file contrast device is it is characterised in that include:
Node element selecting module, for comprise node element from least one file in select at least one unit to be contrasted Plain node;
Resolution file configuration module, at least one unit to be contrasted according to the selection of described node element selecting module The title of plain node, and the keyword message of node element to be contrasted described in each, are configured at least one described in parsing The resolution file of individual file;
Document analysis module, for according to described resolution file, parsing to each file at least one file described, Obtain at least one comparison unit of each file described;
File contrast module, for by least one comparison unit of each file described by each file described with described extremely Alternative document in a few file is contrasted.
2. file contrast device according to claim 1 is it is characterised in that also include:
Whether judge module 210, for comprising arbitrary described element section to be contrasted in the arbitrary comparison unit to arbitrary file The keyword message of point is judged, comprises arbitrary described to be contrasted in the arbitrary comparison unit judging described arbitrary file During the keyword message of node element, described arbitrary comparison unit is added in the list to be contrasted of described arbitrary file;
Described file contrast module, be additionally operable to according to the comparison unit in the list to be contrasted of each file described by described each File is contrasted with the alternative document at least one file described.
3. file contrast device according to claim 2 is it is characterised in that described file contrast module includes:Contrast is single First selecting module and searching modul, wherein,
Described comparison unit selecting module, for selecting to specify contrast single from list to be contrasted described in described arbitrary file Unit;
Described searching modul, for according to the described keyword message in described specified comparison unit from least one file described In arbitrary alternative document in search and comprise the comparison unit of described keyword message;
Described file contrast module, is additionally operable to find from described arbitrary alternative document in described searching modul and comprises described pass During the comparison unit of key word information, described specified comparison unit is contrasted with the described comparison unit finding;Or
When described searching modul does not find, from described arbitrary alternative document, the comparison unit comprising described keyword message, Judge not comprising described specified comparison unit in described arbitrary alternative document.
4. file contrast device according to claim 3 is it is characterised in that also include:
Display module, in described file contrast module by all contrasts in list to be contrasted described in described arbitrary file After unit is all contrasted with corresponding comparison unit in described arbitrary alternative document, will be arbitrary with described for described arbitrary file The comparing result of alternative document is shown according to default order.
5. file contrast device according to any one of claim 1 to 4 is it is characterised in that described file is XML literary composition Part.
6. a kind of file control methods is it is characterised in that include:
Step 302, selects at least one node element to be contrasted from the file that at least one comprises node element;
Step 304, the title of at least one node element to be contrasted according to select, and to be contrasted described in each The keyword message of node element, is configured to parse the resolution file of at least one file described;
Step 306, according to described resolution file, parses to each file at least one file described, obtains described At least one comparison unit of each file;
Step 308, by least one comparison unit of each file described by each file described with described at least one literary composition Alternative document in part is contrasted.
7. file control methods according to claim 6 is it is characterised in that described step 308 also includes:
When comprising arbitrary described keyword message wait the node element contrasting in the arbitrary comparison unit judging arbitrary file, Described arbitrary comparison unit is added in the list to be contrasted of described arbitrary file;
According to the comparison unit in the list to be contrasted of each file described by each file described and at least one file described In alternative document contrasted.
8. file control methods according to claim 7 is it is characterised in that described step 308 is specially:
Select to specify comparison unit, according in described specified comparison unit from list to be contrasted described in described arbitrary file Search in arbitrary alternative document from least one file described for the described keyword message and comprise the right of described keyword message Compare unit;
If finding, in described arbitrary alternative document, the comparison unit comprising described keyword message, by described specified contrast Unit is contrasted with the described comparison unit finding;
If not finding, in described arbitrary alternative document, the comparison unit comprising described keyword message, judge described arbitrary Described specified comparison unit is not comprised in alternative document.
9. file control methods according to claim 8 is it is characterised in that after described step 308, also include:
All corresponding to described arbitrary alternative document in all comparison units in list to be contrasted described in described arbitrary file Comparison unit contrasted after, by the comparing result of described arbitrary file and described arbitrary alternative document according to default suitable Sequence is shown.
10. the file control methods according to any one of claim 6 to 9 is it is characterised in that described file is XML literary composition Part.
CN201310392155.XA 2013-09-02 2013-09-02 File comparison device and file comparison method Active CN103500169B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310392155.XA CN103500169B (en) 2013-09-02 2013-09-02 File comparison device and file comparison method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310392155.XA CN103500169B (en) 2013-09-02 2013-09-02 File comparison device and file comparison method

Publications (2)

Publication Number Publication Date
CN103500169A CN103500169A (en) 2014-01-08
CN103500169B true CN103500169B (en) 2017-02-08

Family

ID=49865380

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310392155.XA Active CN103500169B (en) 2013-09-02 2013-09-02 File comparison device and file comparison method

Country Status (1)

Country Link
CN (1) CN103500169B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868214B (en) * 2015-01-22 2020-03-10 凌群电脑股份有限公司 Automatic test comparison device and method
CN105045918A (en) * 2015-08-24 2015-11-11 用友网络科技股份有限公司 Mutual comparison device for any tables of two databases and mutual comparison method of for any tables of two databases
CN107562763A (en) * 2016-07-01 2018-01-09 阿里巴巴集团控股有限公司 The display methods and device of data variation
CN113419739B (en) * 2021-06-22 2022-12-06 网易(杭州)网络有限公司 Node map difference detection method and device, electronic equipment and storage medium
CN117610536B (en) * 2024-01-23 2024-04-09 南京邮电大学 Automatic judgment method and system for Office operation questions based on XML document similarity

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101916255A (en) * 2010-07-02 2010-12-15 互动在线(北京)科技有限公司 HTML (Hypertext Markup Language) content contrast device and method
CN103136230A (en) * 2011-11-25 2013-06-05 阿里巴巴集团控股有限公司 Comparing method and device of tree-type structure file

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101916255A (en) * 2010-07-02 2010-12-15 互动在线(北京)科技有限公司 HTML (Hypertext Markup Language) content contrast device and method
CN103136230A (en) * 2011-11-25 2013-06-05 阿里巴巴集团控股有限公司 Comparing method and device of tree-type structure file

Also Published As

Publication number Publication date
CN103500169A (en) 2014-01-08

Similar Documents

Publication Publication Date Title
CN103500169B (en) File comparison device and file comparison method
EP2175373B1 (en) Test data creation and execution system for service oriented architecture
US8375362B1 (en) Wizard for web service search adapter
US7711726B2 (en) Method, system and program for creating an index
US7792870B2 (en) Identification and automatic propagation of geo-location associations to un-located documents
US8806330B2 (en) Automatic detection of item lists within a web page
US20090019015A1 (en) Mathematical expression structured language object search system and search method
JP2010501096A (en) Cooperative optimization of wrapper generation and template detection
WO2005052810A1 (en) Method of constructing preferred views of hierarchical data
WO2019077405A1 (en) Method, device, and system, for identifying data elements in data structures
CN101739335A (en) Recommended application evaluation system
JP2010541079A5 (en)
CN111198852A (en) Knowledge graph driven metadata relation reasoning method under micro-service architecture
CN110188165A (en) Contract template acquisition methods, device, storage medium and computer equipment
CN103034580A (en) Method and device and system for fuzzy test
JP2007128450A (en) Software reusable component management system
CN114707051A (en) Web page similar element searching method and system
Dohrn et al. Fine-grained change detection in structured text documents
CN110309364A (en) A kind of information extraction method and device
CN103559127A (en) Defect processing method and defect processor
Hartmann et al. On the notion of an XML key
Le Zou et al. On synchronizing with web service evolution
US9420052B2 (en) Web navigation using web navigation pattern histories
US10866993B2 (en) Managing online help information in a data center
Murolo et al. Deriving custom post types from digital mockups

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100094 Haidian District North Road, Beijing, No. 68

Applicant after: Yonyou Network Technology Co., Ltd.

Address before: 100094 Beijing city Haidian District North Road No. 68, UFIDA Software Park

Applicant before: UFIDA Software Co., Ltd.

COR Change of bibliographic data
C14 Grant of patent or utility model
GR01 Patent grant