CN106293690B - Method and device for generating component object - Google Patents

Method and device for generating component object Download PDF

Info

Publication number
CN106293690B
CN106293690B CN201510369953.XA CN201510369953A CN106293690B CN 106293690 B CN106293690 B CN 106293690B CN 201510369953 A CN201510369953 A CN 201510369953A CN 106293690 B CN106293690 B CN 106293690B
Authority
CN
China
Prior art keywords
component
attribute
webpage
identifier
character string
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
CN201510369953.XA
Other languages
Chinese (zh)
Other versions
CN106293690A (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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510369953.XA priority Critical patent/CN106293690B/en
Publication of CN106293690A publication Critical patent/CN106293690A/en
Application granted granted Critical
Publication of CN106293690B publication Critical patent/CN106293690B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to a method and a device for generating a component object, comprising the following steps: acquiring code for describing webpage components from the code of the webpage; acquiring component identification and parameter information of a webpage component from code for describing the webpage component; acquiring a component model corresponding to the webpage component according to the component identifier; and generating a component object according to the parameter information and the component model. In the process of writing the code of the webpage, technicians only need to write the component identification and the parameter information of the webpage component without writing all the codes of the webpage component into the code of the webpage in advance, and the writing amount of the component identification and the parameter information of the webpage component is far less than that of all the codes of the webpage component, so that the labor cost can be reduced.

Description

Method and device for generating component object
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a component object.
Background
With the rapid development of technology, components have been indispensable application elements in web pages, which are generally composed of a piece of HTML (Hypertext Markup Language) or JS (JavaScript, interpreted scripting Language) code.
Disclosure of Invention
To overcome the problems in the related art, the present invention provides a method and an apparatus for generating a component object.
According to a first aspect of embodiments of the present invention, there is provided a method of generating a component object, the method comprising:
acquiring code for describing webpage components from the code of the webpage;
acquiring component identification and parameter information of a webpage component from code for describing the webpage component; the parameter information comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier;
acquiring a component model corresponding to the webpage component according to the component identifier; the component model comprises each attribute identifier and an attribute information position corresponding to each attribute identifier; for the attribute information position corresponding to each attribute identifier, the attribute information position is used for filling in the attribute information corresponding to the attribute identifier;
and generating a component object according to the parameter information and the component model.
Wherein, the attribute information corresponding to the attribute identifier is an attribute value corresponding to the attribute identifier or a calculation method for calculating the attribute value corresponding to the attribute identifier;
wherein the obtaining code for describing the web page components from the code of the web page comprises:
searching a first preset character string and a second preset character string in the code of the webpage;
acquiring a character string between the first preset character string and the second preset character string;
and combining the first preset character string, the character string positioned between the first preset character and the second preset character, and the second preset character string into a code for describing the webpage component.
Wherein, the obtaining of the component model corresponding to the webpage component according to the component identifier includes:
acquiring a corresponding relation between a component identifier of a preset webpage component and an identifier of a component model;
searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation;
and acquiring the component model corresponding to the identifier of the searched component model from a pre-stored component model library.
Wherein, the number of the obtained component models is one, and the generating of the component object according to the parameter information and the component model includes:
generating a blank component object;
filling the content included in the component model into the blank component object to obtain a reference component object;
and for the attribute information corresponding to each attribute identification, filling the attribute information into the attribute information position corresponding to the attribute identification included in the reference component object to obtain the component object.
The method for generating the component object according to the parameter information and the component model includes:
generating a blank component object;
detecting whether a plurality of component models with at least one same attribute identifier exist in the obtained component models;
when a plurality of component models have at least one same attribute identifier, creating a target number of mutually independent blank sub-objects in the blank component object, wherein the target number is the same as the number of the obtained component models; for each component model, filling contents included in the component model into a blank sub-object to obtain a first reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object to obtain the component object.
When any two component models do not have the same attribute identification, filling the content in each component model into the blank component object to obtain a second reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object to obtain the component object.
Further, the method further comprises:
detecting whether the code of the webpage contains an update character string for updating the component object;
when the code of the webpage contains an update character string for updating the component object; and updating the component object according to the updating character string.
According to a second aspect of embodiments of the present invention, there is provided an apparatus for generating a component object, the apparatus comprising:
the first acquisition module is used for acquiring codes for describing webpage components from the codes of the webpage;
the second acquisition module is used for acquiring the component identification and the parameter information of the webpage component from the code for describing the webpage component; the parameter information comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier;
a third obtaining module, configured to obtain, according to the component identifier, a component model corresponding to the web component; the component model comprises each attribute identifier and an attribute information position corresponding to each attribute identifier; for the attribute information position corresponding to each attribute identifier, the attribute information position is used for filling in the attribute information corresponding to the attribute identifier;
and the generating module is used for generating the component object according to the parameter information and the component model.
Wherein, the attribute information corresponding to the attribute identifier is an attribute value corresponding to the attribute identifier or a calculation method for calculating the attribute value corresponding to the attribute identifier;
wherein the first obtaining module comprises:
the first searching unit is used for searching a first preset character string and a second preset character string in the codes of the webpage;
the first acquiring unit is used for acquiring a character string between the first preset character string and the second preset character;
and the composition module is used for composing the first preset character string, the character string positioned between the first preset character and the second preset character string into a code for describing the webpage component.
Wherein the third obtaining module comprises:
the second acquisition unit is used for acquiring the corresponding relation between the component identification of the preset webpage component and the identification of the component model;
the second searching unit is used for searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation;
and the third obtaining unit is used for obtaining the component model corresponding to the identifier of the searched component model from a prestored component model library.
Wherein, the component model that obtains is one, the generate module includes:
a first generating unit for generating a blank component object;
a first filling unit, configured to fill contents included in the component model into the blank component object to obtain a reference component object;
and the second filling-in unit is used for filling the attribute information corresponding to each attribute identifier into the attribute information position corresponding to the attribute identifier in the reference component object to obtain the component object.
Wherein, the parameter information who obtains is a plurality of and the subassembly model that obtains is a plurality of, the generation module includes:
a second generating unit that generates a blank component object;
the detection unit is used for detecting whether a plurality of component models with at least one same attribute identifier exist in the acquired component models;
a third filling unit, configured to create, when there are multiple component models having at least one same attribute identifier, a target number of mutually independent blank sub-objects in the blank component object, where the target number is the same as the number of the obtained component models; for each component model, filling contents included in the component model into a blank sub-object to obtain a first reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object to obtain the component object.
A fourth filling unit, configured to fill, when any two component models do not have the same attribute identifier, the content included in each component model into a blank component object to obtain a second reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object to obtain the component object.
Further, the apparatus further comprises:
the detection module is used for detecting whether the codes of the webpage contain an update character string for updating the component object;
the updating module is used for updating the component object when the code of the webpage contains an updating character string; and updating the component object according to the updating character string.
The technical scheme provided by the embodiment of the invention can have the following beneficial effects: by the method, in the process of writing a webpage code, if a technician writes a code for describing the webpage component, the technician does not need to write all the codes of the webpage component into the webpage code in advance, only needs to write the component identifier and the parameter information of the webpage component, when the terminal acquires the webpage code and finds the code for describing the webpage component in the webpage code, the component identifier and the parameter information are acquired from the code for describing the webpage component, then the component model which is required by the generation of the webpage component and is generated in advance is acquired according to the component identifier, then the component object is generated by using the parameter information and the acquired component model, and then the component is generated by using the component object. The technical personnel do not need to write all the codes of the webpage components into the codes of the webpage in advance, only need to write the component identification and the parameter information of the webpage components, and the writing amount of the component identification and the parameter information of the webpage components is far less than all the codes of the webpage components, so that the labor cost can be 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.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method of generating a component object in accordance with an exemplary embodiment.
FIG. 2 is a block diagram illustrating an apparatus for generating a component object in accordance with an example embodiment.
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 diagram illustrating a method of generating a component object, as shown in FIG. 1, including the following steps, in accordance with an exemplary embodiment.
In step S101, code describing a web page component is acquired from code of a web page;
when a user needs to obtain a web page, the user may input a URL (Uniform Resource Locator) of the web page to be obtained in the terminal, and the terminal obtains the URL input by the user, obtains a code of the web page corresponding to the URL from the web server according to the URL input by the user, and then renders the code of the web page, so that the web page content included in the web page may be displayed in the display screen of the terminal.
If the code for describing the webpage component is included in the code of the webpage, the code for describing the webpage component needs to be rendered, but the code for describing the webpage component needs to be acquired from the code of the webpage first.
Specifically, the step can be implemented by the following process, including:
11) searching a first preset character string and a second preset character string in the code of the webpage;
when the code for describing the webpage components is to be written in the process of writing the code for describing the webpage components in the server in advance, the technician distinguishes the code for describing the webpage components from other codes by using the preset character strings, for example, a first preset character string is added before the code for describing the webpage components and at a position next to the code for describing the webpage components, and a second preset character string is added after the code for describing the webpage components and at a position next to the code for describing the webpage components, so that the code for describing the webpage components and the codes of other webpages except the code for describing the webpage components can be distinguished in the codes of the webpages by the first preset character string and the second preset character string.
Typically, the second predetermined string is preceded by an identifier, such as identifier "/", that is the same string as the first predetermined string. For example, assuming that the first predetermined string is alert, the second predetermined string is/alert.
For example, assume that the code for a web page is: module ("panda. payload", "oc. lazyload > ]), direct (panda. settagname", "alert type" ("dager" text "/alert [" $ complex ', "$ part'," $ timeout ', "$ ocLazyLoad', function ($ complex, $ part, $ timeout, $ ocLazyLoad) { return: 'E', }, and the first predetermined string is alert, the second predetermined string is/alert.
12) Acquiring a character string between a first preset character string and a second preset character;
for example, a character string type between a first preset character string alert and a second preset character string/alert is obtained as "danger" text "hello" in the code of the above-described web page.
13) And forming a code for describing the webpage assembly by the first preset character string, the character string between the first preset character string and the second preset character string.
For example, a first preset character string alert, a character string type between the first preset character and a second preset character, and a second preset character string/alert are combined to form a code alert type for describing a web page component, which is "danger" text ═ hello "/alert.
In step S102, acquiring component identification and parameter information of the web page component from the code for describing the web page component;
the parameter information of the webpage component comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier; for any attribute information corresponding to an attribute identifier, the attribute information is an attribute value corresponding to the attribute identifier or a calculation method for calculating the attribute value corresponding to the attribute identifier.
In this embodiment of the present invention, when writing a code for describing a web page component in advance, a technician may use a first preset character string as a component identifier of the web page component, and for any attribute identifier and attribute information corresponding to the attribute identifier, associate the attribute identifier and the attribute information corresponding to the attribute identifier with a third character string, where, for example, the third preset character string may be: filling the attribute identifier in a position which is before and next to the third preset character string, including the attribute information by using a double quotation mark, and filling the attribute identifier in a position which is after and next to the third preset character string; the above operation is performed for each of the other attribute identifications and attribute information.
Therefore, the component identifier of the webpage component can be obtained according to the first preset character string, and each attribute identifier of the webpage component and attribute information respectively corresponding to each component identifier can be obtained according to the third preset character string.
Therefore, in this step, the first preset character string may be used as the component identifier of the web page component, and a third preset character string is searched in the code for describing the web page component, for each found third preset character string, the character string before and immediately adjacent to the third preset character string is used as an attribute identifier of the web page component, the character string after and immediately adjacent to the third preset character string and included by the double quotation mark "" is used as attribute information corresponding to the attribute identifier, and the above operations are all performed for each found other third preset character string.
For example, in the above-obtained code alert type for describing the web page component, "danger" text "/alert, a first preset character string alert is used as the component identifier of the web page component, and a third preset character string is found, and two third preset character strings are found.
Wherein, a character string before and immediately after the first third preset character string is type, and a character string included by the double quotation mark after and immediately after the first third preset character string is danger, so that it is possible to regard type as an attribute identification of the web page component and regard danger as attribute information corresponding to the attribute identification type, where the attribute information danger is an attribute value corresponding to the attribute component identification type.
A character string before and immediately after the second third preset character string is a text, and a character string included by the double quotation mark "" after and immediately after the second third preset character string is a hello, so that the text can be used as an attribute identification of the web page component, and the hello can be used as attribute information corresponding to the attribute identification text, wherein the attribute information hello is an attribute value corresponding to the attribute identification text.
In step S103, acquiring a component model corresponding to the web component according to the component identifier of the web component;
wherein, the component model comprises at least one attribute identifier and an attribute information position corresponding to each attribute identifier,
and for the attribute information position corresponding to any attribute identifier, filling the attribute information corresponding to the attribute identifier. The same is true for each of the other attributes identifying the corresponding attribute location.
The component model corresponding to the web page component acquired in this step includes each attribute identifier in the parameter information of the acquired web page component and the attribute information position corresponding to each attribute identifier.
In another embodiment of the present invention, the attribute information position may include placeholder information; the placeholder information may be a placeholder, etc.
The technical personnel can set the corresponding relation between the component identification of the preset webpage component and the identification of the component model, and in the corresponding relation, the component identification of each webpage component corresponds to the identification of at least one component model, namely each webpage component corresponds to at least one component model.
Thus, the step may specifically be: acquiring a corresponding relation between a component identifier of a preset webpage component and an identifier of a component model; searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation; and acquiring the component model corresponding to the identifier of the searched component model from a pre-stored component model library.
In step S104, a component object is generated from the parameter information of the web page component and the acquired component model.
In the first case, if the obtained component model is one, the step may specifically be:
21) generating a blank component object;
22) filling the content in the acquired component model into the blank component object to obtain a reference component object;
wherein, the content included in the component model can be copied; and filling the copied content into the blank component object to obtain the reference component object.
23) And for the attribute information corresponding to each attribute identification, filling the attribute information into the attribute information position corresponding to the attribute identification included in the reference assembly object to obtain the assembly object.
And for the attribute information corresponding to any attribute identifier, searching an attribute information position for filling the attribute information in the reference assembly object according to the attribute identifier, and filling the attribute information in the searched attribute information position. And executing the operation on the attribute information corresponding to each attribute identifier.
In another embodiment of the present invention, if the searched attribute information position contains the placeholder information, the placeholder information in the searched attribute information position needs to be deleted first, and then the attribute information is filled into the searched attribute information position.
For example, assume that the generated blank component object is: component Object { }, and the obtained Component model is: the method includes the steps of generating a Component Model, generating a Component Object, and generating a Component Object, wherein the Component Model is { type [ [ type ] ] ', text [ [ text ] ]' } is equal occupancy information, the Component Model is equal to content type [ [ type ] ] ', text [ [ text ] ] and { } in the Component Object is blank, and the Component Object is { type [ [ type ] ]', text }.
Then, according to the attribute identification type, in the reference Component Object { type [ [ type ] ] ', text [ [ text ] ]' }, an attribute information position for filling in the attribute information danger corresponding to the attribute identification type is searched, and the attribute information position corresponding to the attribute identification type in the reference Component Object is taken as an attribute information position for filling in the attribute information danger corresponding to the attribute identification type, that is, the position where the placeholder information [ [ type ] ] is taken as an attribute information position for filling in the attribute information danger corresponding to the attribute identification type, and then the placeholder information [ [ type ] ] is deleted at the attribute information position for filling in the attribute information danger corresponding to the attribute identification type, and the attribute information danger corresponding to the attribute identification type is filled in the attribute information position.
Finally, according to the attribute identification text, searching an attribute information position for filling attribute information hello corresponding to the attribute identification text in the reference Component Object { type '[ [ type ] ]' }, and the attribute information position corresponding to the attribute identification text in the reference component object is used as the attribute information position for filling the attribute information hello corresponding to the attribute identification text, namely, the position where the position occupying information [ [ text ] ] is used as the attribute information position for filling the attribute information hello corresponding to the attribute identification text, then deleting the placeholder information [ text ] at the attribute information position for filling the attribute information hello corresponding to the attribute identification text, filling the attribute information hello corresponding to the attribute identification text into the attribute information position, this may result in a Component Object of type of dalger, text of hello'.
In the second case, if there are a plurality of parameter information and a plurality of component models, the step may specifically be:
31) generating a blank component object;
32) detecting whether a plurality of component models have at least one same attribute identifier in the obtained component models;
33) when a plurality of component models have at least one same attribute identifier, if the content in the acquired component model is directly added into a blank component object, the parameter information with the same plurality of attribute identifiers exists in the component object, so that a conflict may exist, and therefore, in order to avoid the conflict, a plurality of mutually independent blank sub-objects are created in the blank component object, and the number of the targets is the same as that of the acquired component models; for any component model, filling the content included in the component model into a blank sub-object, and for each other component model, executing the operation; adding contents in different component models in different blank sub-objects to finally obtain a first reference component object; and for the attribute information corresponding to any attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object, and executing the operation for the attribute information corresponding to each other attribute identifier to finally obtain the component object.
Because the sub-objects are independent, the parameter information in any two sub-objects is also independent, and further, the situation of conflict does not exist.
For example, assume that the generated blank component object is: the obtained code for describing the web page Component is: the alert type is "danger" text "hello" class is "button"/alert; and the number of the obtained component models is two, wherein the first component model is as follows: a Component Model { [ type ] ] ', text [ [ text ] ]' }, and a second Component Model is: a Component Model { [ type ] ] ', class [ [ class ] ]' }.
The attribute identification type of the parameter information of one first Component model is the same as the attribute identification type of one parameter information of the second Component model, so in order to avoid conflict, two mutually independent blank sub-objects are created in a blank Component Object { }; then, adding the content in the first Component model to the first blank child Object, and adding the content in the second Component model to the second blank child Object, resulting in a Component Object { (type ═ pointer "text ═ hello" }; component Object { type ═ danger "class ═ button } }.
34) And when any two component models do not have the same attribute identification, if the obtained content in the component models is directly added into blank component objects, finally, the parameter information with the same attribute identification does not exist in the component objects, so that the conflict possibly does not exist. Therefore, the content included in each component model can be filled into the blank component object to obtain a second reference component object; and for the attribute information corresponding to any attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object, and executing the operation for each piece of other parameter information to finally obtain the component object.
Through the mode of the embodiment shown in fig. 1 of the invention, in the process of writing a code of a webpage, if a technician needs to write a code for describing a webpage component, the technician does not need to write all codes of the webpage component into the code of the webpage in advance, but only needs to write a component identifier and parameter information of the webpage component, when a terminal acquires the code of the webpage and finds the code for describing the webpage component in the code of the webpage, the component identifier and parameter information are acquired from the code for describing the webpage component, then an assembly model which is required to be used by the webpage component and is generated in advance is acquired according to the component identifier, then a component object is generated by using the parameter information and the acquired assembly model, and then the assembly object is used to generate the assembly. The technical personnel do not need to write all the codes of the webpage components into the codes of the webpage in advance, only need to write the component identification and the parameter information of the webpage components, and the writing amount of the component identification and the parameter information of the webpage components is far less than all the codes of the webpage components, so that the labor cost can be reduced.
In another embodiment of the present invention, the technician may subsequently update the component object, for example, add some parameter information to the component object, delete some parameter information, or modify some parameter information, and in general, to save the update operation, the technician writes the code for updating the component object at the end of the code of the web page.
Therefore, after step S104, the method further includes: detecting whether a code of a webpage contains an updating character string for updating a component object; when the code of the webpage contains an update character string for updating the component object; and updating the component object according to the updating character string.
For example, assuming that a technician needs to delete parameter information whose attribute is identified as type in a component object, a code for deleting the parameter information whose attribute is identified as type is written at the end of the code of the web page: for example, when detecting this segment of code, according to the string type in the statement, the attribute information corresponding to the attribute identification type and the attribute identification type is searched for in the generated Component Object { type ═ dager ', text ═ hello }, then the attribute information controller corresponding to the attribute identification type and the attribute identification type is deleted in the generated Component Object { type ═ dager', text ═ hello }, and the updated Component Object is obtained { text ═ hello }, thus implementing updating of the Component Object.
FIG. 2 is a block diagram illustrating an apparatus for generating a component object in accordance with an example embodiment. Referring to fig. 2, the apparatus includes:
a first obtaining module 11, configured to obtain, from a code of a web page, a code for describing a web page component;
a second obtaining module 12, configured to obtain a component identifier and parameter information of a web page component from a code for describing the web page component; the parameter information comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier;
a third obtaining module 13, configured to obtain, according to the component identifier, a component model corresponding to the webpage component; the component model comprises each attribute identifier and an attribute information position corresponding to each attribute identifier; for the attribute information position corresponding to each attribute identifier, the attribute information position is used for filling in the attribute information corresponding to the attribute identifier;
and a generating module 14, configured to generate a component object according to the parameter information and the component model.
By means of the embodiment shown in fig. 2 of the present invention, in the process of writing a code of a web page, if a technician needs to write a code for describing a web page component, the technician does not need to write all codes of the web page component into the code of the web page in advance, but only needs to write a component identifier and parameter information of the web page component, when a terminal obtains the code of the web page and finds the code for describing the web page component in the code of the web page, obtains the component identifier and parameter information from the code for describing the web page component, then obtains a component model that is needed to be used for generating the web page component and has been generated in advance according to the component identifier, then generates a component object by using the parameter information and the obtained component model, and then generates a component by using the component object. The technical personnel do not need to write all the codes of the webpage components into the codes of the webpage in advance, only need to write the component identification and the parameter information of the webpage components, and the writing amount of the component identification and the parameter information of the webpage components is far less than all the codes of the webpage components, so that the labor cost can be reduced.
Wherein, the attribute information corresponding to the attribute identifier is an attribute value corresponding to the attribute identifier or a calculation method for calculating the attribute value corresponding to the attribute identifier;
wherein, the first obtaining module 11 includes:
the first searching unit is used for searching a first preset character string and a second preset character string in the codes of the webpage;
the first acquiring unit is used for acquiring a character string between the first preset character string and the second preset character;
and the composition module is used for composing the first preset character string, the character string positioned between the first preset character and the second preset character string into a code for describing the webpage component.
Wherein the third obtaining module 13 includes:
the second acquisition unit is used for acquiring the corresponding relation between the component identification of the preset webpage component and the identification of the component model;
the second searching unit is used for searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation;
and the third obtaining unit is used for obtaining the component model corresponding to the identifier of the searched component model from a prestored component model library.
Wherein, the number of the obtained component models is one, and the generating module 14 includes:
a first generating unit for generating a blank component object;
a first filling unit, configured to fill contents included in the component model into the blank component object to obtain a reference component object;
and the second filling-in unit is used for filling the attribute information corresponding to each attribute identifier into the attribute information position corresponding to the attribute identifier in the reference component object to obtain the component object.
Wherein, the obtained parameter information is a plurality of and the obtained component model is a plurality of, the generating module 14 includes:
a second generating unit that generates a blank component object;
the detection unit is used for detecting whether a plurality of component models with at least one same attribute identifier exist in the acquired component models;
a third filling unit, configured to create, when there are multiple component models having at least one same attribute identifier, a target number of mutually independent blank sub-objects in the blank component object, where the target number is the same as the number of the obtained component models; for each component model, filling contents included in the component model into a blank sub-object to obtain a first reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object to obtain the component object.
A fourth filling unit, configured to fill, when any two component models do not have the same attribute identifier, the content included in each component model into a blank component object to obtain a second reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object to obtain the component object.
Further, the apparatus further comprises:
the detection module is used for detecting whether the codes of the webpage contain an update character string for updating the component object;
the updating module is used for updating the component object when the code of the webpage contains an updating character string; and updating the component object according to the updating character string.
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.

Claims (10)

1. A method of generating a component object, the method comprising:
acquiring code for describing webpage components from the code of the webpage;
acquiring a component identification and a plurality of parameter information of a webpage component from code for describing the webpage component; the parameter information comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier;
acquiring a component model corresponding to the webpage component according to the component identifier; the component model comprises each attribute identifier and an attribute information position corresponding to each attribute identifier; for the attribute information position corresponding to each attribute identifier, the attribute information position is used for filling in the attribute information corresponding to the attribute identifier; the component models are multiple;
generating a component object according to the parameter information and the component model;
generating a component object according to the parameter information and the component model, comprising:
generating a blank component object;
detecting whether a plurality of component models with at least one same attribute identifier exist in the obtained component models;
when a plurality of component models have at least one same attribute identifier, creating a target number of mutually independent blank sub-objects in the blank component object, wherein the target number is the same as the number of the obtained component models; for each component model, filling contents included in the component model into a blank sub-object to obtain a first reference component object; for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object to obtain a component object;
when any two component models do not have the same attribute identification, filling the content in each component model into the blank component object to obtain a second reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object to obtain the component object.
2. The method according to claim 1, wherein the attribute information corresponding to the attribute identifier is an attribute value corresponding to the attribute identifier or a calculation method for calculating an attribute value corresponding to the attribute identifier.
3. The method of claim 1, wherein obtaining code describing components of the web page from code of the web page comprises:
searching a first preset character string and a second preset character string in the code of the webpage;
acquiring a character string between the first preset character string and the second preset character string;
and combining the first preset character string, the character string positioned between the first preset character and the second preset character, and the second preset character string into a code for describing the webpage component.
4. The method of claim 1, wherein the obtaining a component model corresponding to the webpage component according to the component identifier comprises:
acquiring a corresponding relation between a component identifier of a preset webpage component and an identifier of a component model;
searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation;
and acquiring the component model corresponding to the identifier of the searched component model from a pre-stored component model library.
5. The method of claim 1, further comprising:
detecting whether the code of the webpage contains an update character string for updating the component object;
when the code of the webpage contains an update character string for updating the component object; and updating the component object according to the updating character string.
6. An apparatus for generating a component object, the apparatus comprising:
the first acquisition module is used for acquiring codes for describing webpage components from the codes of the webpage;
the second acquisition module is used for acquiring the component identification and the parameter information of the webpage component from the code for describing the webpage component; the parameter information comprises at least one attribute identifier of the webpage component and attribute information corresponding to each attribute identifier;
a third obtaining module, configured to obtain, according to the component identifier, a component model corresponding to the web component; the component model comprises each attribute identifier and an attribute information position corresponding to each attribute identifier; for the attribute information position corresponding to each attribute identifier, the attribute information position is used for filling in the attribute information corresponding to the attribute identifier; the component models are multiple;
the generating module is used for generating a component object according to the parameter information and the component model;
the generation module comprises:
a second generating unit that generates a blank component object;
the detection unit is used for detecting whether a plurality of component models with at least one same attribute identifier exist in the acquired component models;
a third filling unit, configured to create, when there are multiple component models having at least one same attribute identifier, a target number of mutually independent blank sub-objects in the blank component object, where the target number is the same as the number of the obtained component models; for each component model, filling contents included in the component model into a blank sub-object to obtain a first reference component object; for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the first reference component object to obtain a component object;
a fourth filling unit, configured to fill, when any two component models do not have the same attribute identifier, the content included in each component model into a blank component object to obtain a second reference component object; and for the attribute information corresponding to each attribute identifier, filling the attribute information into the attribute information position corresponding to the attribute identifier in the second reference component object to obtain the component object.
7. The apparatus according to claim 6, wherein the attribute information corresponding to the attribute identifier is an attribute value corresponding to the attribute identifier or a calculation method for calculating an attribute value corresponding to the attribute identifier.
8. The apparatus of claim 6, wherein the first obtaining module comprises:
the first searching unit is used for searching a first preset character string and a second preset character string in the codes of the webpage;
the first acquiring unit is used for acquiring a character string between the first preset character string and the second preset character;
and the composition module is used for composing the first preset character string, the character string positioned between the first preset character and the second preset character string into a code for describing the webpage component.
9. The apparatus of claim 6, wherein the third obtaining module comprises:
the second acquisition unit is used for acquiring the corresponding relation between the component identification of the preset webpage component and the identification of the component model;
the second searching unit is used for searching the identification of the component model corresponding to the component identification of the webpage component from the corresponding relation;
and the third obtaining unit is used for obtaining the component model corresponding to the identifier of the searched component model from a prestored component model library.
10. The apparatus of claim 6, further comprising:
the detection module is used for detecting whether the codes of the webpage contain an update character string for updating the component object;
the updating module is used for updating the component object when the code of the webpage contains an updating character string; and updating the component object according to the updating character string.
CN201510369953.XA 2015-06-29 2015-06-29 Method and device for generating component object Active CN106293690B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510369953.XA CN106293690B (en) 2015-06-29 2015-06-29 Method and device for generating component object

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510369953.XA CN106293690B (en) 2015-06-29 2015-06-29 Method and device for generating component object

Publications (2)

Publication Number Publication Date
CN106293690A CN106293690A (en) 2017-01-04
CN106293690B true CN106293690B (en) 2020-02-28

Family

ID=57651155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510369953.XA Active CN106293690B (en) 2015-06-29 2015-06-29 Method and device for generating component object

Country Status (1)

Country Link
CN (1) CN106293690B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115221449A (en) * 2022-08-04 2022-10-21 北京美迪康信息咨询有限公司 Health information acquisition website configuration method and device and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6931416B2 (en) * 2001-12-05 2005-08-16 International Business Machines Corp. Ephemeral list for object-action navigation
CN1937549A (en) * 2006-07-25 2007-03-28 中山大学 Device dynamic assembly management system and method for digital home network
CN101572622A (en) * 2009-03-02 2009-11-04 南京联创科技股份有限公司 Realization method for dynamically expanding resource metadata
CN101599015A (en) * 2009-07-07 2009-12-09 阿里巴巴集团控股有限公司 A kind of method and system of analyzing component
CN101799752A (en) * 2009-12-31 2010-08-11 深圳联友科技有限公司 Method and system for positioning HTML page control variations
CN101980204A (en) * 2010-11-04 2011-02-23 上海银杏界信息科技有限公司 Static webpage automatic updating method
CN103365855A (en) * 2012-03-28 2013-10-23 腾讯科技(深圳)有限公司 Method and server for generating web pages
CN104407901A (en) * 2014-12-08 2015-03-11 北京国双科技有限公司 Code adding method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6931416B2 (en) * 2001-12-05 2005-08-16 International Business Machines Corp. Ephemeral list for object-action navigation
CN1937549A (en) * 2006-07-25 2007-03-28 中山大学 Device dynamic assembly management system and method for digital home network
CN101572622A (en) * 2009-03-02 2009-11-04 南京联创科技股份有限公司 Realization method for dynamically expanding resource metadata
CN101599015A (en) * 2009-07-07 2009-12-09 阿里巴巴集团控股有限公司 A kind of method and system of analyzing component
CN101799752A (en) * 2009-12-31 2010-08-11 深圳联友科技有限公司 Method and system for positioning HTML page control variations
CN101980204A (en) * 2010-11-04 2011-02-23 上海银杏界信息科技有限公司 Static webpage automatic updating method
CN103365855A (en) * 2012-03-28 2013-10-23 腾讯科技(深圳)有限公司 Method and server for generating web pages
CN104407901A (en) * 2014-12-08 2015-03-11 北京国双科技有限公司 Code adding method and device

Also Published As

Publication number Publication date
CN106293690A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
US10565293B2 (en) Synchronizing DOM element references
CN103597469B (en) Live browser instrument in IDE
US9720658B2 (en) Application creation method and apparatus
US10380239B2 (en) Dynamic native advertisment insertion
CN104166656B (en) The webpage methods of exhibiting and device of traffic statistics
KR101494844B1 (en) System for Transforming Chart Using Metadata and Method thereof
CN108572819A (en) Method for updating pages, device, terminal and computer readable storage medium
CN106155673B (en) Method, device, server and user equipment for realizing page content editor
US10049095B2 (en) In-context editing of output presentations via automatic pattern detection
TW201324322A (en) Simulation of web applications and secondary devices in a web browser, web application development tools, and methods using the same
CN105117205B (en) A kind of page authoring method and device
CN110673847A (en) Configuration page generation method and device, electronic equipment and readable storage medium
CN111475161B (en) Method, device and equipment for accessing component
CN106354490A (en) Dynamic layout method for EPG page
CN110069737B (en) Content generation method and device, computer equipment and storage medium
US11403078B2 (en) Interface layout interference detection
US10671801B2 (en) Markup code generator
CN105786846A (en) Website platform component capable of generating modules in user-defined manner
CN113495730A (en) Resource package generation and analysis method and device
CN106293671B (en) Method and device for generating component template
CN106293690B (en) Method and device for generating component object
US20160103815A1 (en) Generating mobile web browser views for applications
CN113094287A (en) Page compatibility detection method, device, equipment and storage medium
CN110399063B (en) Method and device for viewing page element attributes
CN116483344A (en) Code generation method and device, terminal equipment and computer readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200921

Address after: Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200921

Address after: Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: Grand Cayman Islands

Patentee before: Alibaba Group Holding Ltd.