Disclosure of Invention
In order to overcome the problems in the related art, the invention provides an information processing method and device.
According to a first aspect of embodiments of the present invention, there is provided an information processing method, the method including:
acquiring element information of a controllable page element in a webpage, wherein the element information accords with a preset rule, and the element information comprises an element identifier of the controllable page element, a data model for processing the controllable page element and a control mode for controlling the controllable page element;
analyzing the element identification, the data model and the control mode in the element information;
acquiring a preset processing mode bound with the data model and the control mode;
and binding the element identification, the control mode and the processing mode.
The acquiring a preset processing mode bound with the data model and the control mode comprises the following steps:
acquiring a first corresponding relation between an operation mode and a processing mode corresponding to the data model;
and searching a processing mode corresponding to the control mode in the first corresponding relation.
Wherein the binding the element identifier, the manipulation manner, and the processing manner includes:
and forming a record by the element identification, the control mode and the processing mode and storing the record in a second corresponding relation among the element identification, the control mode and the processing mode.
The acquiring element information of the controllable page elements in the webpage, which meet the preset rules, includes:
acquiring element information of controllable page elements in the webpage;
judging whether the element information is bound with a preset keyword corresponding to the preset rule or not;
and when the element information binds a preset keyword corresponding to the preset rule, determining the element information as the element information of the controllable page element conforming to the preset rule.
Wherein the analyzing the element identifier, the data model and the control mode in the element information includes:
searching a first preset identifier and a second preset identifier in the element information;
determining a location preceding the first preset identifier as a location; determining a position between the first preset identifier and the second preset identifier as a position; determining a position located after the second preset identifier as a position;
searching a position corresponding to the preset rule and used for storing an element identifier, a position used for storing a data model and a position used for storing a control mode in the determined three positions respectively;
the element identification is obtained from a position for storing the element identification, the data model is obtained from a position for storing the data model, and the manipulation manner is obtained from a position for storing the manipulation manner.
According to a second aspect of the embodiments of the present invention, there is provided an information processing apparatus including:
the first acquisition module is used for acquiring element information of a controllable page element in a webpage, wherein the element information accords with a preset rule, and the element information comprises an element identifier of the controllable page element, a data model for processing the controllable page element and a control mode for controlling the controllable page element;
the analysis module is used for analyzing the element identification, the data model and the control mode in the element information;
the second acquisition module is used for acquiring a preset processing mode which is bound with the data model and the control mode;
and the binding module is used for binding the element identifier, the control mode and the processing mode.
Wherein the second obtaining module comprises:
the first acquisition unit is used for acquiring a first corresponding relation between the control mode and the processing mode corresponding to the data model;
and the first searching unit is used for searching the processing mode corresponding to the control mode in the first corresponding relation.
The binding module is specifically configured to combine the element identifier, the control manner, and the processing manner into one record and store the record in a second corresponding relationship among the element identifier, the control manner, and the processing manner.
Wherein the first obtaining module comprises:
the second acquisition unit is used for acquiring element information of the controllable page elements in the webpage;
a judging unit configured to judge whether or not a preset keyword corresponding to the preset rule is bound to the element information;
the first determining unit is used for determining the element information as the element information of the controllable page element which accords with the preset rule when the element information is bound with the preset keyword corresponding to the preset rule.
Wherein the parsing module comprises:
a second searching unit, configured to search the element information for a first preset identifier and a second preset identifier;
a second determination unit configured to determine a position located before the first preset identifier as a position; determining a position between the first preset identifier and the second preset identifier as a position; determining a position located after the second preset identifier as a position;
a third searching unit, configured to search, in the determined three positions, a position corresponding to the preset rule and used for storing an element identifier, a position used for storing a data model, and a position used for storing an operation mode, respectively;
and the third acquisition module is used for acquiring the element identifier from the position for storing the element identifier, acquiring the data model from the position for storing the data model, and acquiring the control mode from the position for storing the control mode.
The technical scheme provided by the embodiment of the invention can have the following beneficial effects:
in the prior art, when a technician writes a code of a webpage in advance, a processing function needs to be written for each controllable page element in the webpage, and a binding program for binding the controllable page element, the control mode and the written processing function is written. Second, this labor cost will grow geometrically when the number of web pages that need to be written is large.
By the method of the embodiment of the invention, when a technician writes a code of a webpage, the technician only needs to write the element information of each controllable page element according to the preset rule, wherein the element information comprises the element identifier of the controllable page element, the data model for processing the controllable page element and the control mode for controlling the controllable page element. After the compiling is finished, the server acquires element information of controllable page elements which accord with preset rules in the webpage; analyzing the element identifier, the data model and the control mode in the element information; acquiring a preset processing mode bound with the data model and the control mode; and binding the element identification, the control mode and the processing mode.
In the whole process, processing functions do not need to be written for each controllable page element in the webpage, and a binding program for binding the controllable page elements, the control mode and the written processing functions does not need to be written. The technical personnel only need to bind the control mode and the processing mode in the data model in advance, so that the workload of the technical personnel can be reduced, and the labor cost is further reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Fig. 1 is a flow chart illustrating an information processing method according to an exemplary embodiment, which includes the following steps, as shown in fig. 1.
In step S101, element information of a controllable page element in the web page that meets a preset rule is acquired;
the element information comprises an element identifier of the controllable page element, a data model for processing the controllable page element and a control mode for controlling the controllable page element;
the invention aims to enable the server to automatically bind the operation mode and the processing mode for the controllable page elements without writing a binding program for binding the controllable page elements, the operation mode and the processing function by technicians, so as to reduce the workload of the technicians.
However, sometimes the technician may not need the server to automatically bind the manipulation manner and the processing manner for each of the steerable page elements in the web page, and the technician may selectively let the server automatically bind the manipulation manner and the processing manner for a part of the steerable page elements in the web page.
In the embodiment of the present invention, for a certain controllable page element in a web page, if a technician needs to enable a server to automatically bind a control mode and a processing mode for the controllable page element, when the technician writes a code of the web page, the technician can write element information of the controllable page element according to a preset rule.
The writing of the element information of the controllable page element according to the preset rule can be as follows: and binding the preset keywords corresponding to the preset rules with the element information after the element information is written. For example, a preset keyword and element information corresponding to a preset rule are bound with a reserved identifier. The reserved identifier may be "═ or" - ", and the like, and the present invention is not limited thereto.
For example, assuming that the reserved identifier is "═ then writing the element information of the steerable page element according to the preset rule may be: "preset keyword is element information", or "element information is a preset keyword".
Thus, in the step, the server can obtain the element information of the controllable page elements in the webpage; judging whether a preset keyword corresponding to the preset rule is bound to the element information or not; and when the element information binds a preset keyword corresponding to the preset rule, determining the element information as the element information of the controllable page element conforming to the preset rule. And when the element information is not bound with the preset keyword corresponding to the preset rule, determining that the element information is not the element information of the controllable page element conforming to the preset rule.
In step S102, the element identifier, the data model, and the manipulation manner in the element information are analyzed;
specifically, the step can be implemented by the following process, including:
1021. searching a first preset identifier and a second preset identifier in the element information;
when the technical staff writes the element information of the controllable page elements in the webpage according to the preset rules, at least three contents are filled in the element information, wherein the three contents are respectively as follows: the technical staff can add a preset identifier between any two adjacent contents in the element identification of the controllable page element, the data model for processing the controllable page element and the control mode for controlling the controllable page element. The preset identifier may be ": "/" and "|", etc., the present invention is not limited thereto. Since only three contents are included in the element information, two preset identifiers are included in the element information.
In this way, in this step, a preset identifier may be searched for in the element information, the preset identifier located on the left side in the element information is used as a first preset identifier, and the preset identifier located on the right side in the element information is used as a second preset identifier.
For example: assume that the preset identifier is ": "the preset keyword is" data-rule ", and the element information may be: "element identification: and (3) data model: manipulation manner ". The writing of the element information of the steerable page element according to the preset rule may be: "data-rule ═ element identification: and (3) data model: manipulation manner ".
1022. Determining a position located before the first preset identifier as a position; determining a position between the first preset identifier and the second preset identifier as a position; determining a location located after the second preset identifier as a location;
1023. searching a position corresponding to the preset rule and used for storing the element identifier, a position used for storing the data model and a position used for storing the control mode in the determined three positions respectively;
in the embodiment of the present invention, in the preset rule, the mutual position order among the element identifier, the data model, and the manipulation manner in the element information is fixed. When a technician writes element information of controllable page elements in a webpage according to a preset rule, the element information needs to be respectively filled with element identifiers, data models and control modes according to the mutual position sequence.
For example, in the preset rule, if the position order of the element identifier is the first position, the position before the first preset identifier is the position for storing the element identifier; if the position sequence of the data model is the second position, the position between the first preset identifier and the second preset identifier is the position for storing the data model; and if the position sequence of the manipulation mode is the last position, the position behind the second preset identifier is the position for storing the manipulation mode. In this way, in the element information of the steerable page elements in the webpage written by the technician according to the preset rule, the element identifier should be located before the data model and the steering mode, the data model should be located after the element identifier and before the steering mode, and the steering mode should be located after the element identifier and the data model.
1024. The element identifier is obtained from a location for storing the element identifier, the data model is obtained from a location for storing the data model, and the manipulation manner is obtained from a location for storing the manipulation manner.
Specifically, content located in a position for storing an element identifier is acquired and determined as an element identifier in the element information; acquiring content in a position for storing the manipulation mode and determining the content as a data model in the element information; content located in a location for storing the data model is obtained and determined as a manipulation manner in the element information.
In step S103, a preset processing mode bound to the data model and the manipulation mode is obtained;
in the embodiment of the present invention, the manipulation manner is a manner in which the user controls the steerable page element. The control mode comprises double click of a left mouse button, click of the left mouse button or click of a right mouse button and the like.
However, sometimes the same manipulation manner may correspond to a plurality of different processing manners. If the technician previously binds the manipulation manner to each of the plurality of different processing manners, respectively. Then, when the user manipulates one manipulated page element in the web page according to the manipulation manner, the terminal may obtain a plurality of different processing manners when obtaining the processing manner bound to the manipulation manner, and at this time, the server may not determine which processing manner the manipulated page element should be processed in, and if one processing manner is randomly selected, a processing error may be caused.
For example, for a certain steerable page element, assume that the technician wants to achieve one goal: when a user clicks the certain controllable page element by using a left mouse button, the terminal needs to amplify the certain controllable page element; therefore, the technician will bind the manipulation mode "clicking the left mouse button" and the processing mode "amplifying" in advance.
For another example, for another steerable page element, assume that the technician wants to achieve another goal: when the user clicks the other controllable page element by using the left mouse button, the terminal needs to delete the other controllable page element from the webpage. Therefore, the technician will bind the manipulation mode "clicking the left mouse button" and the processing mode "deleting" in advance.
In this way, when the displayed webpage of the terminal includes the certain controllable page element, if the user feels that the certain controllable page element is small, the user can control the certain controllable page element to be amplified on the terminal, wherein the user can click the certain controllable page element by using the left mouse button, so that the terminal can acquire the processing mode set by the technician and bound with the control mode of "clicking the left mouse button", however, when the processing mode bound with the control mode of "clicking the left mouse button" is acquired, two different processing modes, namely "amplifying" and "deleting" are acquired. At this time, the terminal cannot determine which processing method should be used to process the certain controllable page element, that is, at this time, the server cannot determine whether the certain controllable page element should be enlarged or deleted from the web page. If the terminal chooses to delete the certain controllable page element from the webpage, the purpose of 'amplifying the certain controllable page element' is not achieved, and processing errors are caused.
Therefore, in order to avoid processing errors, a data model is introduced in the embodiment of the invention.
In the embodiment of the present invention, a plurality of different data models may exist at the same time, and for any one data model, a technician needs to register a first corresponding relationship between a manipulation manner and a processing manner, which corresponds to the data model, in advance, and may add a plurality of records in the first corresponding relationship, where each record includes a manipulation manner and a processing manner. In the first corresponding relationship, the manipulation manners in any two records are different, that is, in the first corresponding relationship, each manipulation manner can only correspond to one processing manner, but cannot simultaneously correspond to a plurality of different processing manners. When a manipulation manner and a processing manner need to be newly added in the first corresponding relationship, the manipulation manner and the processing manner can be combined into a record to be stored in the first corresponding relationship. When a record including a certain manipulation manner and a processing manner is added to the first corresponding relationship, the record including the certain manipulation manner cannot be added to the first corresponding relationship, and when the record including the certain manipulation manner and the processing manner needs to be added, the record needing to be newly added is added to the corresponding relationship between the manipulation manner and the processing manner, which is registered in advance and corresponds to other data models. The same is true for each of the other data models.
Therefore, the step may specifically be: acquiring a first corresponding relation between an operation mode and a processing mode corresponding to the data model; and searching a processing mode corresponding to the control mode in the first corresponding relation.
In step S104, the element identifier, the manipulation manner, and the processing manner are bound.
The step can be specifically as follows: and forming a record by the element identification, the control mode and the processing mode and storing the record in a second corresponding relation among the element identification, the control mode and the processing mode.
Therefore, when a user needs to browse the webpage later, the terminal acquires the webpage content of the webpage from the server, renders the content and displays the content on the browser, and acquires the second corresponding relation from the server, when the user controls the controllable page element corresponding to the element identifier in the control mode, the terminal searches the processing mode corresponding to the element identifier and the control mode in the second corresponding relation acquired from the server, and then processes the controllable page element corresponding to the element identifier in the searched processing mode.
For example, if the manipulation manner is clicking a left mouse button, and the processing manner is zooming in the controllable page element, the server may zoom in the controllable page element corresponding to the element identifier after the user controls the cursor to be located on the controllable page element corresponding to the element identifier and clicks the left mouse button.
For another example, if the manipulation manner is to double-click the left mouse button, and the processing manner is to delete the controllable page element, then after the user control cursor is located on the controllable page element corresponding to the element identifier and double-click the left mouse button, the server deletes the controllable page element corresponding to the element identifier from the web page.
In the prior art, when a technician writes a code of a webpage in advance, a processing function needs to be written for each controllable page element in the webpage, and a binding program for binding the controllable page element, the control mode and the written processing function is written. Second, this labor cost will grow geometrically when the number of web pages that need to be written is large.
By the method of the embodiment of the invention, when a technician writes a code of a webpage, the technician only needs to write the element information of each controllable page element according to the preset rule, wherein the element information comprises the element identifier of the controllable page element, the data model for processing the controllable page element and the control mode for controlling the controllable page element. After the compiling is finished, the server acquires element information of controllable page elements which accord with preset rules in the webpage; analyzing the element identifier, the data model and the control mode in the element information; acquiring a preset processing mode bound with the data model and the control mode; and binding the element identification, the control mode and the processing mode.
In the whole process, processing functions do not need to be written for each controllable page element in the webpage, and a binding program for binding the controllable page elements, the control mode and the written processing functions does not need to be written. The technical personnel only need to bind the control mode and the processing mode in the data model in advance, so that the workload of the technical personnel can be reduced, and the labor cost is further reduced.
Fig. 2 is a block diagram illustrating an information processing apparatus according to an exemplary embodiment. Referring to fig. 2, the apparatus includes:
the first obtaining module 11 is configured to obtain element information of a controllable page element in a webpage, where the element information includes an element identifier of the controllable page element, a data model used for processing the controllable page element, and a control manner used for controlling the controllable page element, and the element information conforms to a preset rule;
the analysis module 12 is configured to analyze the element identifier, the data model, and the manipulation manner in the element information;
a second obtaining module 13, configured to obtain a preset processing mode bound to the data model and the control mode;
and a binding module 14, configured to bind the element identifier, the manipulation manner, and the processing manner.
Wherein the second obtaining module 13 includes:
the first acquisition unit is used for acquiring a first corresponding relation between the control mode and the processing mode corresponding to the data model;
and the first searching unit is used for searching the processing mode corresponding to the control mode in the first corresponding relation.
The binding module 14 is specifically configured to combine the element identifier, the control manner, and the processing manner into one record and store the record in a second corresponding relationship among the element identifier, the control manner, and the processing manner.
Wherein, the first obtaining module 11 includes:
the second acquisition unit is used for acquiring element information of the controllable page elements in the webpage;
a judging unit configured to judge whether or not a preset keyword corresponding to the preset rule is bound to the element information;
the first determining unit is used for determining the element information as the element information of the controllable page element which accords with the preset rule when the element information is bound with the preset keyword corresponding to the preset rule.
Wherein, the parsing module 12 includes:
a second searching unit, configured to search the element information for a first preset identifier and a second preset identifier;
a second determination unit configured to determine a position located before the first preset identifier as a position; determining a position between the first preset identifier and the second preset identifier as a position; determining a position located after the second preset identifier as a position;
a third searching unit, configured to search, in the determined three positions, a position corresponding to the preset rule and used for storing an element identifier, a position used for storing a data model, and a position used for storing an operation mode, respectively;
and the third acquisition module is used for acquiring the element identifier from the position for storing the element identifier, acquiring the data model from the position for storing the data model, and acquiring the control mode from the position for storing the control mode.
The technical scheme provided by the embodiment of the invention can have the following beneficial effects:
in the prior art, when a technician writes a code of a webpage in advance, a processing function needs to be written for each controllable page element in the webpage, and a binding program for binding the controllable page element, the control mode and the written processing function is written. Second, this labor cost will grow geometrically when the number of web pages that need to be written is large.
By the method of the embodiment of the invention, when a technician writes a code of a webpage, the technician only needs to write the element information of each controllable page element according to the preset rule, wherein the element information comprises the element identifier of the controllable page element, the data model for processing the controllable page element and the control mode for controlling the controllable page element. After the compiling is finished, the server acquires element information of controllable page elements which accord with preset rules in the webpage; analyzing the element identifier, the data model and the control mode in the element information; acquiring a preset processing mode bound with the data model and the control mode; and binding the element identification, the control mode and the processing mode.
In the whole process, processing functions do not need to be written for each controllable page element in the webpage, and a binding program for binding the controllable page elements, the control mode and the written processing functions does not need to be written. The technical personnel only need to bind the control mode and the processing mode in the data model in advance, so that the workload of the technical personnel can be reduced, and the labor cost is further reduced.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.