Disclosure of Invention
In order to overcome the defects in the prior art and achieve the purposes, the invention provides the following technical scheme that the xml-pull-based dynamic plug-in extension system is applied to an extension platform and comprises the following steps:
The file construction module is used for extracting basic information of the plug-in, screening plug-in characteristics from the basic information, wherein the plug-in characteristics comprise dependency characteristics, compatibility characteristics, format characteristics and permission characteristics, and constructing the plug-in characteristics into xml files based on file construction criteria;
the demand judging module is used for acquiring the expansion attribute of the xml file, wherein the expansion attribute comprises a type magnitude and a form magnitude, calculating the demand coefficient of the xml file and judging whether the dynamic expansion demand is met;
The interface screening module is used for identifying attribute states of the application program interfaces one by one, wherein the attribute states comprise busy interfaces and idle interfaces, and the extensible interfaces are screened out from the interfaces according to the attribute states;
The coefficient calculation module is used for acquiring expansion parameters of the expandable interface, wherein the expansion parameters comprise concurrent request number, effective response time length and error occupation ratio, calculating the expansion coefficient of the expandable interface according to the expansion parameters, and screening a target interface from the expandable interface;
And the dynamic expansion module is used for importing the xml file into the application program through the target interface, analyzing the xml file based on the xml-pull analyzer and controlling the dynamic expansion of the plug-in.
Further, the method for screening the dependency, compatibility, format and permission features comprises the following steps:
inquiring the comprehensive information of the plug-in through an information management system, marking the identity remark frames of the comprehensive information one by one, and identifying remark words in the identity remark frames;
Marking an identity remark frame with remark words as plug-ins as a basic remark frame, and marking comprehensive information corresponding to the basic remark frame as basic information;
the key semantics of the basic information are identified one by one through a natural language processing technology, and the key semantics are split to obtain text semantics and digital semantics;
And respectively recording the key semantics of the text semantics as the dependency semantics, the compatibility semantics, the format semantics and the permission semantics, and combining the dependency semantics, the compatibility semantics, the format semantics and the permission semantics with the corresponding digital semantics end to generate the dependency characteristics, the compatibility characteristics, the format characteristics and the permission characteristics.
Further, the file construction criterion is that one feature bit only contains one plug-in feature;
The method for constructing the xml file comprises the following steps:
Constructing a blank basic file through a file construction tool, and sequentially drawing four character positions arranged in a straight line in the basic file;
sequentially numbering the four characteristic bits in an ascending order according to a front-to-back mode to obtain a first characteristic bit, a second characteristic bit, a third characteristic bit and a fourth characteristic bit;
Marking file association points at two ends of the first feature bit, the second feature bit, the third feature bit and the fourth feature bit respectively, and establishing association channels between two adjacent file association points;
And importing the dependent features, the compatible features, the format features and the permission features into the first feature bit, the second feature bit, the third feature bit and the fourth feature bit one by one to generate an xml file.
Further, the method for acquiring the type magnitude and the form magnitude comprises the following steps:
Inquiring i attribute information of an xml file through a technical parameter table, marking attribute words of the i attribute information one by one, and marking the attribute information of which the attribute words are in a type and a form as first information and second information respectively;
Inquiring the construction time of all the first information and the second information one by one through the time stamp, and arranging the construction time one by one according to the sequence of the time to generate a first arrangement row and a second arrangement row;
Marking first information with the same construction time in the first arrangement row as type information, and counting the number of the type information to obtain a type magnitude;
Recording second information which does not have the same construction time in the second arrangement row as form information, and counting the quantity of the form information to obtain a form magnitude;
The expression of the demand coefficient is: ;
in the formula, Is the demand coefficient of the xml file,Is the type magnitude of an xml file,Is the formal magnitude of the xml file.
Further, the method for judging whether the dynamic expansion requirement is met comprises the steps of integrating the requirement coefficient of the xml fileAnd a preset demand thresholdComparing;
When (when) Greater than or equal toWhen the dynamic expansion requirement is met, judging;
When (when) Less thanAnd when the dynamic expansion requirement is not met, judging.
Further, the method for identifying the busy interface and the idle interface comprises the following steps:
Inquiring the work logs of p interfaces of the application program one by one through a database, and marking state indication columns from the work logs to obtain p state indication columns;
identifying the potential values in the p state indication columns one by one, and counting the number of all the potential values to obtain p total value;
counting the number of potential values 0 in p state indication columns one by one to obtain p working low-level values;
When the working low-order value of the interface is more than or equal to two-thirds total value, the attribute state of the interface is recorded as an idle interface;
when the working low-order value of the interface is smaller than two-thirds total value, recording the attribute state of the interface as a busy interface;
The screening method of the extensible interface comprises the following steps:
When the attribute state of the interface is busy, the interface is not recorded as an extensible interface;
when the interface attribute of the interface is busy state, the interface is marked as an extensible interface to obtain And an extensible interface.
Further, the method for acquiring the effective response time length comprises the following steps:
respectively inquiring through a log management system Historical operation logs of the extensible interfaces are marked, and execution requests in the historical operation logs are marked to obtainExecuting the request;
One by one inquired out through time stamps Receiving time and executing time of each executing request, and recording time length from the receiving time to the executing time as sub-time length to obtainSub-duration;
Will be Averaging after accumulating sub-time length to obtainA valid response time period;
the expression of the effective response time length is: ;
in the formula, Is the firstThe effective response time of each expandable interface,Is the firstThe first expandable interfaceSub-time periods.
Further, the error occupancy ratio obtaining method includes:
Taking the current moment as a starting point, pushing forward a preset return period, and generating a request tracing period;
inquiring one by one through a system monitoring tool All the return requests of the extensible interfaces in the request tracing period are marked one by one to identify the state value in the state frame;
The status frame with the status value of 1 is marked as an error frame, the return request corresponding to the error frame is marked as an error request, and the number of the error requests is counted to obtain Error magnitude values;
Counting one by one The total amount of return requests of the extensible interfaces is obtainedRequest total value and willThe error values are sequentially combined withComparing the total values of the requests to obtainA personal error occupancy ratio;
the error ratio is expressed as: ;
in the formula, Is the firstThe error occupancy value of the one expandable interface,Is the firstThe error magnitude of one of the scalable interfaces,Is the firstA request total value of the extensible interfaces;
The expansion coefficient is expressed as: ;
in the formula, Is the firstThe expansion coefficients of the one expandable interface,Is the firstThe number of concurrent requests for an extensible interface,Is a weight factor greater than 0.
Further, the method for analyzing the xml file comprises the following steps:
switching the working state of the target interface to an on state, importing an xml file into the target interface of the application program, and switching the working state of the target interface to an off state;
Marking a first information bit and a last information bit in an xml file respectively, and marking the first information bit and the last information bit as an analysis starting point and an analysis end point;
And introducing an xml-pull parser into the application program, and reading and parsing the information in the xml file according to the sequence from the parsing start point to the parsing end point until the xml file is parsed.
The dynamic plug-in expansion method based on the xml-pull is applied to an expansion platform, and is realized based on the dynamic plug-in expansion system based on the xml-pull, and comprises the following steps:
S1, extracting basic information of a plugin, screening plugin characteristics from the basic information, wherein the plugin characteristics comprise dependency characteristics, compatibility characteristics, format characteristics and permission characteristics, and constructing the plugin characteristics into xml files based on file construction criteria;
s2, obtaining an extension attribute of the xml file, wherein the extension attribute comprises a type magnitude and a form magnitude, calculating a demand coefficient of the xml file, and judging whether the dynamic extension demand is met;
S3, if the dynamic expansion requirement is met, the attribute states of the application program interfaces are identified one by one, wherein the attribute states comprise busy interfaces and idle interfaces, and expandable interfaces are screened out from the interfaces according to the attribute states;
S4, obtaining expansion parameters of the expandable interface, wherein the expansion parameters comprise the concurrent request number, effective response time length and error occupation ratio, calculating expansion coefficients of the expandable interface according to the expansion parameters, and screening out target interfaces from the expandable interface;
s5, importing the xml file into the application program through the target interface, analyzing the xml file based on the xml-pull analyzer, and controlling the dynamic expansion of the plug-in.
The dynamic plug-in expansion system and the method based on xml-pull have the technical effects and advantages that:
The invention extracts basic information of the plug-in, screens out plug-in characteristics from the basic information, builds the plug-in characteristics into an xml file based on a file construction criterion, obtains the expansion attribute of the xml file, calculates the demand coefficient of the xml file, judges whether the dynamic expansion demand is met, identifies the attribute states of interfaces of the application program one by one, screens out expandable interfaces from the interfaces according to the attribute states, acquires expansion parameters of the expandable interfaces, calculates the expansion coefficient of the expandable interfaces according to the expansion parameters, screens out target interfaces from the expandable interfaces, guides the xml file into the application program through the target interfaces, analyzes the xml file based on an xml-pull analyzer, and controls the dynamic expansion of the plug-in.
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.
An embodiment one, referring to fig. 1 and 2, is an xml-pull-based dynamic plug-in extension system, applied to an extension platform, including:
The file construction module extracts basic information of the plug-in, screens out plug-in characteristics from the basic information, and constructs the plug-in characteristics into an xml file based on file construction criteria;
The basic information is comprehensive basic parameters of the plug-in capable of dynamically expanding with the application program, namely the plug-in which needs to be expanded with the application program can be specifically represented, so that a basis is provided for the dynamic expansion of the subsequent plug-in;
The plug-in feature is a feature capable of influencing whether dynamic expansion operation between the plug-in and the application program is successful or not, and is used as an object for constructing an xml file, and meanwhile, the related expansion feature of the plug-in can be accurately and simply represented;
The plug-in features comprise a dependence feature, a compatibility feature, a format feature and a permission feature, wherein the dependence feature refers to the dependence environment and the condition required by the plug-in during dynamic expansion, the compatibility feature refers to the platform and the version required by the plug-in during dynamic expansion, the format feature refers to the file type required by the plug-in during dynamic expansion, and the permission feature refers to the identity authority required by the plug-in during dynamic expansion;
the screening method of the dependency features, the compatibility features, the format features and the permission features comprises the following steps:
The comprehensive information of the plug-in is inquired through an information management system, an identity remark frame of the comprehensive information is marked one by one, remark words in the identity remark frame are identified, the comprehensive information is information capable of representing all contents of the plug-in, namely the plug-in can be comprehensively represented, the identity remark frame is used for summarizing and collecting contents of the type of the comprehensive information, and the remark words are words directly representing the type of the comprehensive information and are used for accurately distinguishing different types of the comprehensive information;
Marking an identity remark frame with remark words as plug-ins as a basic remark frame, and marking comprehensive information corresponding to the basic remark frame as basic information;
The key semantics of the basic information are identified one by one through a natural language processing technology, and the key semantics are split to obtain text semantics and digital semantics, wherein the key semantics are words used for directly and definitely representing the real meanings in the basic information, so that a concise and effective representation effect of the basic information is realized;
the key semantic meaning of the text semantic meaning as the dependency semantic meaning is recorded as the dependency semantic meaning, and the dependency semantic meaning is combined with the corresponding digital semantic meaning end to generate a dependency feature;
The key semantic meaning of the text semantic meaning being compatible is recorded as compatible semantic meaning, and the compatible semantic meaning is combined with the corresponding digital semantic meaning end to generate compatible features;
The key semantic meaning of the text semantic meaning of the format is recorded as the format semantic meaning, and the format semantic meaning is combined with the corresponding digital semantic meaning end to generate the format characteristic;
And recording the key semantics of which the literal semantics are the permissions as the permission semantics, and combining the permission semantics with the corresponding digital semantics in an end-to-end manner to generate permission features.
After the plug-in features are obtained, an xml file can be constructed according to the plug-in features, so that the xml file can be associated and fused with an application program and is an object for realizing dynamic expansion of the plug-in subsequently;
When the plug-in features are constructed into the xml file, the order and stability of a plurality of plug-in features in the constructed xml file are ensured, and the phenomenon of mutual interference and dislocation of the plug-in features in the xml file is prevented, so that the construction limitation of the xml file is required by means of a file construction rule;
the file construction criterion is that one feature bit only contains one plug-in feature, so that a plurality of plug-ins in an xml file are in mutually independent states, the front-back adhesion of the plug-in features in adjacent feature bits is avoided, and the stability of the xml file is improved;
The method for constructing the xml file comprises the following steps:
the method comprises the steps of constructing a blank basic file through a file construction tool, and sequentially drawing four character positions arranged in a straight line in the basic file, wherein the basic file is a blank file without substantial contents and is used as a construction basis of a subsequent xml file, and the character positions are the smallest units forming the basic file and are used for providing accurate imported positions for data in the xml file;
sequentially numbering the four characteristic bits in an ascending order according to a front-to-back mode to obtain a first characteristic bit, a second characteristic bit, a third characteristic bit and a fourth characteristic bit;
Marking file association points at two ends of a first feature bit, a second feature bit, a third feature bit and a fourth feature bit respectively, and establishing association channels between two adjacent file association points, wherein the file association points are output points and input points used for information interaction on the feature bit, and the association channels are information interaction channels constructed on the file association points between the two adjacent feature bits, so that information on the two adjacent feature bits can be associated with each other, and information in the feature bits in an xml file can have comprehensive and accurate association representation effect on the plugin;
And importing the dependent features, the compatible features, the format features and the permission features into the first feature bit, the second feature bit, the third feature bit and the fourth feature bit one by one to generate an xml file.
It should be noted that only one plug-in feature is included in one feature bit, so that one xml file can orderly and independently represent features affecting dynamic expansion of a plug-in, and plug-in features in two adjacent feature bits can be associated through an association channel, so that an association transmission effect among a plurality of plug-in features is ensured, and the integrity of the plug-in is ensured.
The demand judging module is used for acquiring the expansion attribute of the xml file, calculating the demand coefficient of the xml file and judging whether the dynamic expansion demand is met or not;
The extension attribute is a judging basis for judging whether the follow-up dynamic extension operation can be carried out on the xml file, and meanwhile, the extension attribute can accurately represent the type and form of the xml file and provide a basis for the follow-up identification and analysis of the xml file;
The type quantity value is used for representing the number of the expansion types of the xml file, and the form quantity value is used for representing the number of the dynamic expansion requirements of different forms in the xml file, and the form quantity value is used for representing the number of the expansion forms of the xml file;
the method for acquiring the type magnitude and the form magnitude comprises the following steps:
Inquiring i attribute information of the xml file through a technical parameter table, marking attribute words of the i attribute information one by one, and marking the attribute information of which the attribute words are in types and forms as first information and second information respectively;
Inquiring the construction time of all the first information and the second information one by one through the time stamp, and arranging the construction time one by one according to the sequence of the time to generate a first arrangement row and a second arrangement row;
Marking first information with the same construction time in the first arrangement row as type information, and counting the number of the type information to obtain a type magnitude;
And recording the second information which does not have the same construction time in the second arrangement row as form information, and counting the quantity of the form information to obtain a form magnitude.
The demand coefficient is used for representing the rationality of the dynamic expansion of the xml file and the application program and is used as a judging basis for judging whether the follow-up dynamic expansion demand of the xml file is met or not;
The expression of the demand coefficient is: ;
in the formula, Is the demand coefficient of the xml file,Is the type magnitude of an xml file,Is the formal magnitude of the xml file.
The dynamic expansion requirement is used for representing whether the xml file meets the basic dynamic expansion requirement of the application program or not, namely, the rationality of the xml file can be verified, so that the dynamic expansion requirement of the plug-in can be negated when the xml file lacks basic rationality, and the unreasonable dynamic expansion requirement of the plug-in is prevented from negatively affecting the stability of the application program;
the method for judging whether the dynamic expansion requirement is met comprises the following steps:
demand coefficient of xml file And a preset demand thresholdThe preset demand threshold value is used for effectively and accurately distinguishing the demand coefficient of the xml file by representing the maximum value of the demand coefficient of the xml file, wherein the rationality of dynamic expansion of the xml file is not in a specified range, and the dynamic expansion demand of the xml file is not in a normal range, so as to provide a judgment basis for whether the dynamic expansion operation is executed subsequently;
When (when) Greater than or equal toWhen the demand coefficient of the xml file is larger than or equal to a preset demand threshold, the reasonability of dynamic expansion of the xml file is within a specified range, and the dynamic expansion demand of the xml file does not exceed a normal range, so that the dynamic expansion demand is judged to be met;
When (when) Less thanWhen the demand coefficient of the xml file is smaller than the preset demand threshold, the reasonability of dynamic expansion of the xml file is not in the specified range, and the dynamic expansion demand of the xml file exceeds the normal range, so that the dynamic expansion demand is judged not to be met.
The interface screening module identifies attribute states of the application program interfaces one by one, and screens extensible interfaces from the interfaces according to the attribute states;
The attribute state is used for representing information of the expansion interfaces of the application programs, so that the meaning and the information of the interfaces of each application program are represented in a concise manner, and the attribute state is used for effectively identifying different use requirements of the interfaces of the application programs;
the attribute state comprises a busy interface and an idle interface, wherein the busy interface refers to the busy working state of the expansion interface of the application program, has no effect of dynamic expansion, and the idle interface refers to the idle working state of the expansion interface of the application program, has the effect of dynamic expansion;
the method for identifying the busy interface and the idle interface comprises the following steps:
The method comprises the steps of inquiring working logs of p interfaces of an application program one by one through a database, and marking state indication columns from the working logs to obtain p state indication columns, wherein the working logs are used for integrally representing the running condition of the interfaces in a historical time period, and the state indication columns are used for directly representing the working states of the interfaces;
The method comprises the steps of identifying potential values in p state indication columns one by one, counting the number of all the potential values to obtain p total value values, wherein the potential values are numerical representations for indicating whether the interface is in an operating state or an inactive state, and the potential values comprise 1 and 0;
counting the number of potential values 0 in p state indication columns one by one to obtain p working low-level values;
When the working low-order value of the interface is more than or equal to two-thirds total value, the number of the potential values in the state indication column is more than 0, the period of time when the interface is in an idle state is longer, and the attribute state of the interface is recorded as an idle interface;
When the working low-order value of the interface is smaller than the two-thirds total value, the number of the potential values in the state indication column is smaller, the period of the interface in the idle state is shorter, and the attribute state of the interface is recorded as a busy interface.
After the attribute state of the application program interface is identified, the interface meeting the dynamic expansion requirement can be effectively identified according to the different attribute states of each interface, and an expandable interface is obtained, so that the expandable interface can be used as an alternative interface for dynamic expansion of a subsequent approach plugin;
The screening method of the extensible interface comprises the following steps:
When the attribute state of the interface is a busy state, the interface of the application program is always in the busy state, the interface can not provide sufficient and stable import expansion requirements for the dynamic expansion of the plug-in, and the interface is not recorded as an expandable interface;
When the interface attribute of the interface is busy state, the interface of the application program is not always busy state, the interface can provide sufficient and stable import expansion requirement for dynamic expansion of the plug-in, and the interface is recorded as an expandable interface to obtain And an extensible interface.
It should be noted that, the expandable interfaces are only used to represent interfaces that meet the dynamic expansion requirement of the plug-in, where the number of expandable interfaces is generally greater than 1, which indicates that the number of expandable interfaces that meet the dynamic expansion requirement of the plug-in is greater, and in order to better screen out the best interface from the expandable interfaces, further analysis and screening processes need to be performed on multiple expandable interfaces.
The coefficient calculation module is used for obtaining expansion parameters of the expandable interface, calculating the expansion coefficients of the expandable interface according to the expansion parameters, and screening out a target interface from the expandable interface;
The expansion parameters are performance change data which can influence the expandable interface when the dynamic expansion of the plug-in unit is satisfied, and the performance strength of the expandable interface when the dynamic expansion of the plug-in unit is satisfied can be represented, so that the expandable interface is used as a screening basis for the expandable interface with the strongest performance in the follow-up process;
the expansion parameters comprise the number of concurrent requests, effective response time length and error occupation ratio;
The concurrent request number refers to the maximum value of the request number which can be received and processed by the extensible interface at the same time when the extensible interface runs under load, namely the request number which can be simultaneously processed by the extensible interface can be expressed, when the concurrent request number is larger, the maximum value of the request number which can be received and processed by the extensible interface at the same time when the extensible interface runs under load is larger, and when the performance of dynamic expansion of the extensible interface plug-in is stronger, the expansion coefficient is larger;
The effective response time length is the time length between the receiving of the request and the executing of the request when the extensible interface is in load operation, namely the processing timeliness of the request can be expressed by the extensible interface, when the effective response time length is larger, the time length between the receiving of the request and the executing of the request when the extensible interface is in load operation is larger, and when the performance of the extensible interface for dynamically expanding the plug-in is weaker, the expansion coefficient is smaller;
the method for acquiring the effective response time length comprises the following steps:
respectively inquiring through a log management system Historical operation logs of the extensible interfaces are marked, and execution requests in the historical operation logs are marked to obtainExecuting the request;
One by one inquired out through time stamps Receiving time and executing time of each executing request, and recording time length from the receiving time to the executing time as sub-time length to obtainSub-duration;
Will be Averaging after accumulating sub-time length to obtainA valid response time period;
the expression of the effective response time length is: ;
in the formula, Is the firstThe effective response time of each expandable interface,Is the firstThe first expandable interfaceSub-time periods.
The error occupation ratio is the occupation ratio between the number of the returned error requests and the total number of the returned error requests in the unit time of the load operation of the extensible interface, so that the processing correctness of the requests can be expressed by the extensible interface;
the error occupation ratio acquisition method comprises the following steps:
The method comprises the steps of taking the current moment as a starting point, and pushing forward a preset return period to generate a request tracing period, wherein the preset return period is a limit of the maximum duration for tracing the return request, so that the inquiry and the record of the related data of the return request in a reasonable duration range can be ensured;
inquiring one by one through a system monitoring tool The method comprises the steps that all return requests of a plurality of extensible interfaces are in a request tracing period, all state frames of the return requests are marked one by one, and state values in the state frames are identified, wherein the state frames are used for remarking sets of specific types of the return requests, and the state values are numerical representations of the specific types of the return requests;
The status frame with the status value of 1 is marked as an error frame, the return request corresponding to the error frame is marked as an error request, and the number of the error requests is counted to obtain Error magnitude values;
Counting one by one The total amount of return requests of the extensible interfaces is obtainedRequest total value and willThe error values are sequentially combined withComparing the total values of the requests to obtainA personal error occupancy ratio;
the error ratio is expressed as: ;
in the formula, Is the firstThe error occupancy value of the one expandable interface,Is the firstThe error magnitude of one of the scalable interfaces,Is the firstThe total value of the requests for the extensible interfaces.
After the concurrent request number, the effective response time length and the error occupation ratio are obtained, an expansion coefficient can be calculated according to the concurrent request number, the effective response time length and the error occupation ratio, so that the expansion coefficient can be used as a judging basis for screening a target interface;
The expansion coefficient is expressed as: ;
in the formula, Is the firstThe expansion coefficients of the one expandable interface,Is the firstThe number of concurrent requests for an extensible interface,A weight factor greater than 0;
Wherein, The dimensions of the exemplary,At the level of 0.43 of the total number of the components,The total number of the components is 0.35,The total number of the components was 0.22,The setting is to balance the ratio of the concurrent request number, the effective response time length and the error ratio in the expansion coefficient, so as to ensure that the expansion coefficient can keep a dynamic balance effect with the concurrent request number, the effective response time length and the error ratio.
After the expansion coefficient is calculated, the dynamic expansion performance intensity of the expandable interface can be expressed according to the size of the expansion coefficient, so that the expandable interface with the strongest dynamic expansion performance is screened out according to the size of the expansion coefficient to be used as a target interface for subsequent use, and therefore the expandable interface corresponding to the maximum value of the expansion coefficient can be recorded as the target interface.
The dynamic expansion module is used for importing the xml file into the application program through the target interface, analyzing the xml file based on the xml-pull analyzer and controlling the plug-in to dynamically expand;
After the target interface is obtained, the target interface can be used as an interface for guiding an xml file and an application program into the dynamic expansion, and before the dynamic expansion of the xml file, the constructed xml file is required to be analyzed, so that the application program can directly and accurately obtain the expansion requirement of the plug-in unit, and a guarantee is provided for the dynamic expansion of the subsequent plug-in unit;
the method for analyzing the xml file comprises the following steps:
The method comprises the steps of switching the working state of a target interface into an opening state, importing an xml file into the target interface of an application program, and switching the working state of the target interface into a closing state, wherein the working state refers to the running state of the target interface capable of importing the xml file, so that the opening and closing conditions of the target interface are represented;
Marking a first information bit and a last information bit in an xml file respectively, and marking the first information bit and the last information bit as an analysis starting point and an analysis end point;
And introducing an xml-pull parser into the application program, and reading and parsing the information in the xml file according to the sequence from the parsing start point to the parsing end point until the xml file is parsed.
After the xml file is analyzed, the analyzed xml file can be dynamically expanded in the application program, so that the target interface of the application program can be effectively connected with the plug-in unit and dynamically expanded;
When the plug-in is dynamically expanded, the dynamic expansion process between the plug-in and the application program is required to be effectively controlled, so that an expansion protocol with the same mechanism is required to be configured between the application program and the plug-in, the application program and the plug-in can realize the dynamic expansion effect of the plug-in by adopting a reflection dynamic loading plug-in mode under the limitation of the expansion protocol, the application program can be ensured to keep dynamic balance when the plug-in is dynamically expanded, the stable operation of the application program is prevented from being influenced when the plug-in is dynamically expanded, and meanwhile, the interference to the original program of the application program is avoided when the plug-in is dynamically expanded.
In the embodiment, the basic information of the plug-in is extracted, the plug-in characteristics are screened out from the basic information, the plug-in characteristics are constructed into the xml file based on the file construction criterion, the expansion attribute of the xml file is acquired, the demand coefficient of the xml file is calculated, whether the dynamic expansion demand is met or not is judged, the attribute states of the interfaces of the application program are identified one by one, the expandable interfaces are screened out from the interfaces according to the attribute states, the expansion parameters of the expandable interfaces are acquired, the expansion coefficient of the expandable interfaces is calculated according to the expansion parameters, the target interfaces are screened out from the expandable interfaces, the xml file is imported into the application program through the target interfaces, the xml file is analyzed based on the xml-pull analyzer, and the dynamic expansion of the plug-in is controlled.
Referring to fig. 3, the embodiment is not described in detail, but in part, the description of embodiment one is provided, and an xml-pull-based dynamic plug-in extension method is applied to an extension platform, and implemented by an xml-pull-based dynamic plug-in extension system, and includes:
S1, extracting basic information of a plugin, screening plugin characteristics from the basic information, wherein the plugin characteristics comprise dependency characteristics, compatibility characteristics, format characteristics and permission characteristics, and constructing the plugin characteristics into xml files based on file construction criteria;
s2, obtaining an extension attribute of the xml file, wherein the extension attribute comprises a type magnitude and a form magnitude, calculating a demand coefficient of the xml file, and judging whether the dynamic extension demand is met;
S3, if the dynamic expansion requirement is met, the attribute states of the application program interfaces are identified one by one, wherein the attribute states comprise busy interfaces and idle interfaces, and expandable interfaces are screened out from the interfaces according to the attribute states;
S4, obtaining expansion parameters of the expandable interface, wherein the expansion parameters comprise the concurrent request number, effective response time length and error occupation ratio, calculating expansion coefficients of the expandable interface according to the expansion parameters, and screening out target interfaces from the expandable interface;
s5, importing the xml file into the application program through the target interface, analyzing the xml file based on the xml-pull analyzer, and controlling the dynamic expansion of the plug-in.
Referring to fig. 4, the disclosure of the present embodiment provides an electronic device, including a processor and a memory;
wherein the memory stores a computer program for the processor to call;
And the processor executes the dynamic plug-in expansion method based on xml-pull by calling the computer program stored in the memory.
Since the electronic device described in this embodiment is an electronic device used to implement the dynamic plug-in extension method based on xml-pull in the second embodiment of the present application, based on the dynamic plug-in extension method based on xml-pull described in the embodiment of the present application, those skilled in the art can understand the specific implementation of the electronic device and various modifications thereof, so how to implement the method in the embodiment of the present application for this electronic device will not be described in detail herein. As long as the electronic equipment adopted by the person skilled in the art to implement the dynamic plug-in extension method based on xml-pull in the embodiment of the application belongs to the scope of the application to be protected.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention.