CN106814998B - Form serialization method and device - Google Patents

Form serialization method and device Download PDF

Info

Publication number
CN106814998B
CN106814998B CN201510850123.9A CN201510850123A CN106814998B CN 106814998 B CN106814998 B CN 106814998B CN 201510850123 A CN201510850123 A CN 201510850123A CN 106814998 B CN106814998 B CN 106814998B
Authority
CN
China
Prior art keywords
preset
target
hierarchical structure
serialization
sequence
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
CN201510850123.9A
Other languages
Chinese (zh)
Other versions
CN106814998A (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.)
Cainiao Smart Logistics Holding Ltd
Original Assignee
Cainiao Smart Logistics 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 Cainiao Smart Logistics Holding Ltd filed Critical Cainiao Smart Logistics Holding Ltd
Priority to CN201510850123.9A priority Critical patent/CN106814998B/en
Publication of CN106814998A publication Critical patent/CN106814998A/en
Application granted granted Critical
Publication of CN106814998B publication Critical patent/CN106814998B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment provides a form serialization method embodiment, which responds to a serialization instruction of a target form, acquires the target form with a hierarchical structure, and acquires names of form elements from the target form, wherein the names are named according to a preset naming rule, and the preset naming rule can represent the hierarchical structure of the target form, so that the names of the form elements are analyzed according to the preset naming rule to determine the hierarchical structure of the target form, and the target form is serialized into sequence data reflecting the preset hierarchical structure. Therefore, compared with the prior art, the embodiment can use the names of the form elements to represent the hierarchical structure of the form, and can serialize the target form into the sequence data with the hierarchical relationship according to the hierarchical structure analyzed from the names, and the sequence data can enable the subsequent processing to be faster. In addition, the application also provides a form serialization device so as to ensure the application and implementation of the method in practice.

Description

Form serialization method and device
Technical Field
The present application relates to the field of form processing technologies, and in particular, to a form serialization method and apparatus, a computer device, and a computer readable medium.
Background
And the form is contained in a webpage displayed at the front end and mainly completes the data acquisition function. Specifically, the form usually includes a plurality of input boxes, and after the user fills and submits data in the input boxes, the data in the input boxes is transmitted to the subsequent processing module for processing by the subsequent processing module.
For example, the account registration page includes an account name input box and a password input box, and after the user inputs the account name and the password respectively, the user can click a submit button to send the account name and the password to the background system for storage.
It will be appreciated that the forms need to undergo a serialization process before being sent to subsequent processing modules. In the existing form serialization method, the generated serialization data are independent from each other and cannot be directly used for subsequent processing, so that the subsequent processing process is complicated and not fast enough.
Disclosure of Invention
In view of this, the present application provides a form serialization method, so as to solve the technical problem that the subsequent processing process is relatively complicated due to the serialization data generated by the existing form serialization method. In addition, the application also provides a form serialization device which is used for ensuring the application and the realization of the method in practice.
In order to achieve the purpose, the technical scheme provided by the application is as follows:
a first aspect of the present application provides a form serialization method, including:
responding to a serialization instruction of a target form, and obtaining the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
analyzing the name of each form element to determine a preset hierarchical structure of the target form;
and serializing the target form into sequence data reflecting the preset hierarchical structure according to the preset hierarchical structure.
A second aspect of the present application provides a form serialization apparatus, including:
the element name acquisition module is used for responding to a serialization instruction of a target form and acquiring the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
the hierarchical structure analysis module is used for analyzing the name of each form element according to the preset naming rule so as to determine the preset hierarchical structure of the target form;
and the target form sequence module is used for serializing the target form into sequence data reflecting the preset hierarchical structure.
A third aspect of the present application provides a computer device comprising:
the method comprises the following steps: a processor and a memory, the processor invoking data stored in the memory by executing a software program stored in the memory to perform the following operations:
responding to a serialization instruction of a target form, and obtaining the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
analyzing the name of each form element to determine a preset hierarchical structure of the target form;
serializing the target form into sequence data reflecting the preset hierarchical structure.
A fourth aspect of the present application provides a computer-readable medium storing a program for causing a computer to execute a process for form serialization, the execution including the steps of:
an element name obtaining step, which is used for responding to a serialization instruction of a target form and obtaining the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
analyzing the hierarchical structure, namely analyzing the name of each form element to determine the preset hierarchical structure of the target form;
a target form serialization step of serializing the target form into sequence data reflecting the preset hierarchical structure. As can be seen from the above, the present application has the following advantageous effects:
the method comprises the steps of responding to a serialization instruction of a target form, obtaining the name of each form element from the target form, wherein the name is named according to a preset naming rule, the preset naming rule can represent a preset hierarchical structure of the target form, analyzing the name of the form element to determine the hierarchical structure of the target form, and then serializing the target form into sequence data reflecting the preset hierarchical structure. Therefore, compared with the prior art, the method can use the names of the form elements to represent the hierarchical structure of the form, and can serialize the target form into the sequence data with the hierarchical relationship according to the hierarchical structure analyzed from the names, and the sequence data can enable the subsequent processing to be faster.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of embodiment 1 of a form serialization method provided by the present application;
fig. 2 is a diagram illustrating an exemplary application scenario provided in the present application;
FIG. 3 is a flow chart of embodiment 2 of the form serialization method provided in the present application;
FIG. 4 is a schematic structural diagram of an embodiment 1 of the form serialization apparatus provided in the present application;
FIG. 5 is a schematic structural diagram of an embodiment 2 of the form serialization apparatus provided in the present application;
fig. 6 is a hardware architecture diagram of a computer device for form serialization provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a flow of embodiment 1 of the form serialization method provided in the present application is shown. As shown in fig. 1, the embodiment may specifically include: step S101 to step S104.
Step S101: and responding to the serialization instruction of the target form, and acquiring the target form with a preset hierarchical structure.
The web page can contain a form, the form contains a plurality of form elements, and the form elements are used for collecting data required by the web page. For example, the order submitting page provided by the shopping website can enable the user to add a new receiving address. After the user clicks the button of the newly added delivery address, the order submitting page displays a province input box, a city input box, a district input box and the like, and the input boxes are table elements in the newly added address form. After the user enters the corresponding data in the form element, the submit order button may be clicked. Of course, this example is only a specific application scenario of this embodiment, and the present application is not limited to this, and may also be network ticket booking, account registration, customized merchandise, and the like, and any application scenario in which data is collected using a form in the prior art may be within the scope of the present application.
The form, when submitted, generates serialized instructions. The serialization instruction is used for serializing the data collected by the form element. In particular, form serialization is the process of specifying which form element in a form collects what data for subsequent processing of the data.
In implementation, if an instruction for serializing a certain form is received, the serializing module serializes the certain form according to the method provided in this embodiment. Of course, for ease of description, this certain form may be referred to as the target form. First, the target form, and more specifically, the data in each form element of the target form, needs to be obtained. For example, when a new shipping address is added, the obtained data are respectively: the data in the province input box is "Liaoning province", the data in the city input box is "Shenyang city", and the data in the prefecture input box is "Shenbei New district".
It should be noted that the target form is a form having a predetermined hierarchical structure. The predetermined hierarchy may be a hierarchy between table elements. For example, when new shipping addresses are added, the levels of the province input box, the city input box, and the prefecture input box are sequentially lowered. In addition, the predetermined hierarchical structure may be a hierarchical structure between the form elements and the form as a whole. For example, when registering an account, the name input box, the age input box, and the password input box may be considered as a next hierarchy of the overall structure of the account. Of course, the hierarchy may be a combination of the two structures. Taking the new delivery address as an example, except that the provincial input box, the city input box and the prefecture input box have a hierarchical structure, all the new delivery addresses can be considered as the lower-level structure of the overall structure of the delivery address.
Step S102: traversing each form element of the target form to obtain the name of each form element; the names of the table elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form.
As can be appreciated, a form element has several attributes, including a name attribute, which is used to uniquely represent the form element in the form. The target form has a predetermined hierarchical structure that appears on the names of the form elements. Therefore, each form element in the target form can be traversed to search the name attribute of each form element, and further obtain the value of the name attribute, thereby obtaining the name of the form element.
It should be noted that, names of the form elements are named according to a preset naming rule, and the names of the form elements can indicate the hierarchy of the form elements in the hierarchy.
Step S103: and analyzing the name of each form element according to a preset naming rule to determine the preset hierarchical structure of the target form.
As described above, the preset naming rule represents the preset hierarchical structure of the target form by defining the name of the form element, and therefore, the name of the form element is also parsed according to the element naming rule, thereby determining the preset hierarchical structure of the target form.
It is understood that the predetermined hierarchy structure needs to include a plurality of hierarchy nodes having a sequentially gradient hierarchical relationship therebetween. For example, in the application scenario of the new shipping address, the preset hierarchical structure of the new shipping address form may be that the highest hierarchical node is "address", and the lower hierarchical nodes are "province", "city", and "district" in sequence.
Step S104: the target form is serialized into sequence data reflecting a predetermined hierarchical structure.
As above, both the values of an form element and the values of the form elements need to be specified when the target form is serialized. Therefore, a specific implementation manner of this step may be that, according to a preset hierarchical structure, each hierarchical node is sequentially generated, and in the target form, the element value of each form element is obtained, and each element value is used as the sequence value of the respective lowest hierarchical node. The structure comprising the hierarchy nodes and sequence values may be referred to as sequence data, i.e., the sequence data generated after the target form is serialized.
It should be noted that the format of the sequence data is preset, and what format of the sequence data is generated is set according to the subsequent processing, that is, what format of the data needs to be used in the subsequent processing, and what format of the sequence data is generated. For example, the format of the sequence data may be a JSON (JavaScript Object Notification) Object format, a string format, an array format, or an XML (extensible Markup language) format. Of course, these formats are merely illustrative examples, and the present application is not limited thereto, and any data format that can embody a hierarchical structure may be included in the scope of the present application.
The form serialized data can be transmitted to a processing module at the front end of the form, so that the processing module can perform subsequent processing; or, the form serialized data may be transmitted to the processing module at the back end, so that the processing module at the back end performs subsequent processing. The specific contents of the subsequent processing may be storage, modification, and the like. It should be noted that, regardless of the form and content, the subsequent processing refers to processing that requires the use of a hierarchical structure. For example, when storing, it is necessary to store data of the same hierarchy together.
In the existing form serialization method, the generated sequence data are independent from each other, a hierarchical relationship is not reflected among the sequence data, and the sequence data cannot be directly used for subsequent processing, so that the subsequent processing process is complicated and not fast enough.
Specifically, in the existing form serialization method, the generated serialized data is a character string. For example, the form includes three table elements, which are named "provide", "city" and "area", respectively, and the values of the table elements are "liaoning", "shenyang" and "shenbei new area", respectively, and the generated serialized data is "provide ═ liaoning", "city ═ shenyang", "shenbei ═ shenbei new area". In the subsequent processing, the values of the form elements are extracted, for example, city, shenyang city, which does not directly reflect the hierarchical relationship with other form element values, and the subsequent processing needs to further determine the hierarchical relationship between the form elements, which is not convenient and fast.
According to the technical scheme, the embodiment of the form serialization method is characterized in that the target form with the hierarchical structure is obtained in response to a serialization instruction of the target form, and then the name of each form element is obtained from the target form, the name is named according to the preset naming rule, and the preset naming rule can represent the preset hierarchical structure of the target form, so that the name of the form element is analyzed according to the preset naming rule to determine the hierarchical structure of the target form, and the target form is serialized into the sequence data reflecting the preset hierarchical structure. Therefore, compared with the prior art, the embodiment can use the names of the form elements to represent the hierarchical structure of the form, and can serialize the target form into the sequence data with the hierarchical relationship according to the hierarchical structure analyzed from the names, and the sequence data can enable the subsequent processing to be faster.
The sequence data generated by the prior art and the present application will be described below with reference to a specific application scenario.
When the user fills in the shipping address in the order submitting page of the client, and clicks the button of the new shipping address, as shown in fig. 2, the order submitting page displays the input boxes of province, city, district (county) and street. Suppose that the user inputs "Liaoning province", "Shenyang city", "Shenbei new district" and "build West road" in turn in the input box, and clicks the order submitting button, the client is triggered to execute the serialization processing for the newly added receiving address.
When the client side serializes the form of the shipping address, the whole shipping address is used as a form, and each input box is used as an element in the form.
In the conventional serialization processing method, names of table elements are independent, for example, a province input box is named as "provide", a city input box is named as "city", a district input box is named as "area", and a street input box is named as "street", so that serialization data generated by a client is "provide & city & Shenbei & street & Shenbei & Street & Xiu & Xi.
However, in the present application, there is a hierarchical relationship between form elements, and the hierarchical relationship is reflected by the names of the form elements. For example, the name of the province input box is address.
The data in the input box is used as the element value of the table element, and the corresponding relation between the table element and the element value is as follows: (address.) service ═ jenning, jew; address, business, city, "shenyang city"; address, city, area ═ new zone, shen; facility, street, the "construction west road".
And analyzing the name of each table element to determine the hierarchical structure relationship. The determined hierarchical relationship is represented using some object format having a hierarchical structure, and the data value of the form element is added to the hierarchy in which the form element is located.
For example, the serialized data of the shipping address is expressed by using the JSON object format, as follows:
Figure GDA0001333511710000071
the above serialized results have a hierarchical relationship, the client sends the serialized data to the server, and the server can use the hierarchical relationship to perform subsequent processing on the serialized results.
In practical applications, the preset naming rule may specifically be that the name of the table element includes a plurality of structure objects, the structure objects are separated by using a flag bit, and a front-back position relationship of the structure objects is used to represent a high-low hierarchical relationship of the structure objects. For example, the form of the new shipping address includes three form elements, the names of which are: "address.
Aiming at the preset naming rule in the form, the application provides an embodiment 2 of the form serialization method. As shown in fig. 3, the embodiment may specifically include: step S301 to step S307.
Step S301: and responding to the serialization instruction of the target form, and acquiring the target form with a preset hierarchical structure.
Step S302: traversing each form element of the target form to obtain the name of each form element; the names of the table elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form.
It should be noted that, the above steps S301 and S302 can refer to the description in the above form serialization method embodiment 1, and are not repeated herein, and only the steps S303 to S307 will be described below.
Step S303: and searching a flag bit in the names of the tablettes according to the sequence from front to back or from back to front aiming at the names of each tablettes.
And traversing the target form, finding out the names of the form elements, and then respectively performing inverse analysis on the names of the form elements according to the preset naming rules.
Specifically, in the names of table elements, the flag bits are searched from front to back or from back to front. Alternatively, the flag may be various symbols such as dots, commas, semicolons, or addition marks, and the specific form of the flag is not limited in this application.
Step S304: when the flag bit is found, the levels of the structural object before and after the flag bit are respectively determined; the hierarchy of the structure object before the zone bit is higher than that of the structure object after the zone bit, and the plurality of structure objects with high-low hierarchical relation are used for representing the preset hierarchical structure of the target form.
As can be seen from the above, the preset naming rule uses the front-back position relationship of the flag bits to represent the high-low level relationship of the hierarchical structure. For example, in the form element name "address.service.city", the structural objects before and after the first marker dot are "address" and "service", respectively, and the hierarchy of the structural object "address" is higher than that of the structural object "service". Similarly, according to the second marker dot, the hierarchy of the structural object "provide" is higher than that of the structural object "city".
Therefore, after the flag is found in step S301, the levels of the structure objects on both sides of the flag are set according to the preset naming rule. Wherein the hierarchy of the structure object before the flag bit is higher than the hierarchy of the structure object after the flag bit. For example, the level of the structural object "address" before the first marker dot is 0, the level of the structural object "progress" after the first marker dot is 1, and the level of the structural object "city" before the second marker dot is 2. In the case of representing the hierarchy by using a number, a lower numerical value of the hierarchy indicates a higher hierarchy. Of course, other ways of representing the hierarchy may be used, and different definitions of the hierarchy values may be assigned.
Step S305: the structure objects of each form element are sequenced in turn in a hierarchy from high to low.
The structure objects analyzed from the names of the form elements, namely the above-mentioned hierarchy nodes, sequentially generate each structure object, and thus the hierarchy structure can be obtained. For each tableelement, it is necessary to serialize the structure object of the tableelement. In practical application, if some form elements have the same name, the structure objects analyzed are also the same. In this case, when a table element is serialized and a structure object of the table element already exists is checked, the structure object already existing is used instead of generating a new structure object.
For example, if the form element 1 is "address, progress, city", and the form element 2 is "address, progress, city", the structural objects obtained by analyzing the names of the two form elements are the same, and both of them include "address", "progress", and "city". In this case, only one hierarchy including "address", "progress", and "city" is generated as follows:
Figure GDA0001333511710000091
of course, if a table element includes a plurality of structure objects, wherein a part of the structure objects already exist and another part of the structure objects do not exist, the another part of the structure objects continues to be generated under the already existing structure objects.
For example, the form element 3 is: "form.base.id 100"; the epi-element 4 is: "form. When the table element 3 is serialized, the generated hierarchical structure is as follows:
Figure GDA0001333511710000101
when serializing the form element 4, after the name of the form element 4 is resolved, the hierarchical structure form needs to be generated first in the order of the hierarchy level from the top to the bottom, but the hierarchical structure already exists, so the serialization can be continued in the existing hierarchical structure. Specifically, a hierarchy advance and a hierarchy other are sequentially generated under the hierarchy form, and the final result is:
Figure GDA0001333511710000102
alternatively, the sequence data may be in some predetermined format, such as the JSON object format, string format, array format, or XML format listed above. The presentation of the sequence data is different, albeit in a different format. However, the target form hierarchy can be embodied.
For example, generating sequence data in JSON object format using table element "address.
Figure GDA0001333511710000111
For another example, if the table element is used to generate the sequence data in the string format, the specific steps are as follows: '{ "address" { "provide": { "city": Shenyang city } } }'.
If the table elements are used to generate sequence data in XML format, the following steps are specifically performed:
Figure GDA0001333511710000112
therefore, the sequence data in various forms can show a hierarchical structure analyzed according to the table unit elements.
Step S306: in the target form, the element values of each form element are obtained.
As above, a user may enter data in input boxes provided on a form page, such as text boxes, radio boxes, check boxes, drop down lists, and the like, and the user may write or select data for different input boxes. The input box is a form element, and the data input by the user is the element value of the form element.
When the target form is serialized, the element values of each form element in the target form need to be acquired.
Step S307: and taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element.
In the hierarchical structure generated in step S305, the lowest level structure object needs to have a sequence value, which is an element value of an tableelement. After the element value of each form element is written into the lowest-level structure object corresponding to the form element, the final serialization result of the target form is obtained, namely the sequence data reflecting the preset hierarchical structure.
As can be seen from the foregoing technical solutions, in the form serialization method provided in this embodiment, the preset naming rule uses a flag to distinguish each hierarchical structure, and uses a front-back position relationship to represent a hierarchical level relationship, and according to the preset naming rule, names of form elements can be analyzed, so that the target form is serialized into data having a hierarchical structure.
In practical applications, the element values of the table elements may be of different data types, and if the data types of the element values are different, the manner of generating the sequence values of the lowest level structure object is different.
Thus, the preset naming convention may also provide that element values of different data types are distinguished using different identifiers. For example, common data types for element values include character strings and arrays, and the two data types can be represented by "< >" and "[ ]", respectively.
For such specific form, step S307 (taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element) in the above form serialization method embodiment 2 may specifically include the following steps a1 and a 2.
Step A1: and determining the data type of the element value of each table element according to the preset corresponding relation between the identifier type and the data type.
The element values acquired from the target form have identifiers, and the data types of the element values are determined according to the types of the identifiers.
For example, if the name and element value of a certain form element are form. For another example, the name and element value of a certain form element are form.
Step A2: and according to the data type of the element value of each form element, taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element.
Wherein, different data types and different sequence value forms are generated. For example, if the data type is a string, then the sequence value is generated in the form of a string. And if the data type is an array, the generated sequence value is in the form of an array.
For example, sequence data corresponding to the form element form, advance, other < >, 123456 are:
Figure GDA0001333511710000131
for another example, the sequence data corresponding to table element form.
Figure GDA0001333511710000132
When the above single element form, advance, list [ ] is 100000, the corresponding sequence data is:
Figure GDA0001333511710000133
it should be noted that the above identifiers "< >" and "[ ]" are merely exemplary illustrations, and of course, other forms of identifiers may be used to distinguish the data types, and the present application is not limited in particular.
The identifier is not limited to being located after the lowest hierarchical structure, and may be a mark of the lowest hierarchical structure. For example, in table element form, advance, list [ ] ═ 100000, the identifier "[ ]" is located after the hierarchy "list", but of course: advance. [ list ] ═ 100000.
The form serialization apparatus provided in the present application is described below, and it should be noted that the following description of the form serialization apparatus may refer to the form serialization method provided above, and is not repeated below.
Corresponding to the above form serialization method embodiment 1, the present application provides a form serialization apparatus embodiment 1. As shown in fig. 4, this embodiment may specifically include: a target form acquisition module 401, an element name acquisition module 402, a hierarchical structure analysis module 403 and a target form sequence module 404; wherein:
a target form obtaining module 401, configured to obtain a target form with a preset hierarchical structure in response to a serialization instruction for the target form;
an element name obtaining module 402, configured to traverse each form element of the target form to obtain a name of each form element; the names of the table elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
a hierarchical structure analysis module 403, configured to analyze the name of each form element according to a preset naming rule to determine a preset hierarchical structure of the target form;
a target form serialization module 404, configured to serialize the target form into sequence data reflecting a preset hierarchical structure.
According to the above technical solution, in the embodiment of the form serialization device provided in the present application, the target form obtaining module 401 obtains the target form with a hierarchical structure in response to a serialization instruction for the target form, and then the element name obtaining module 402 obtains a name of each form element from the target form, where the name is named according to a preset naming rule, and the preset naming rule can represent a preset hierarchical structure of the target form, so that the hierarchical structure analyzing module 403 analyzes the names of the form elements according to the preset naming rule to determine the hierarchical structure of the target form, and then the target form serialization module 404 serializes the target form into sequence data reflecting the preset hierarchical structure. Therefore, compared with the prior art, the embodiment can use the names of the form elements to represent the hierarchical structure of the form, and can serialize the target form into the sequence data with the hierarchical relationship according to the hierarchical structure analyzed from the names, and the sequence data can enable the subsequent processing to be faster.
Corresponding to the above form serialization method embodiment 2, the present application provides a form serialization apparatus embodiment 2. In embodiment 2 of the present apparatus, the preset naming rule includes: the names of the form elements comprise a plurality of structural objects, the structural objects are separated by using a flag bit, and the front-back position relation of the structural objects is used for representing the high-low hierarchical relation of the structural objects.
Specifically, as shown in fig. 5, the present embodiment may include: a target form obtaining module 501, an element name obtaining module 502, a flag bit searching sub-module 503, a structure object hierarchy determining sub-module 504, a structure object generating sub-module 505, an element value obtaining sub-module 506, and a sequence value generating sub-module 507. Wherein:
a target form obtaining module 501, configured to obtain a target form with a preset hierarchical structure in response to a serialization instruction for the target form;
an element name obtaining module 502, configured to traverse each form element of the target form to obtain a name of each form element; the names of the table elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
the flag bit searching submodule 503 is configured to search, for the name of each tabletted element, a flag bit in the names of the tabletted elements in a sequence from front to back or from back to front;
a structure object hierarchy determining submodule 504, configured to determine, whenever a flag is found, hierarchies of a structure object before the flag and a structure object after the flag respectively; the hierarchy of the structure object before the zone bit is higher than that of the structure object after the zone bit, and the plurality of structure objects with high-low hierarchical relation are used for representing the preset hierarchical structure of the target form.
A structural object generation submodule 505, configured to sequentially generate each structural object according to a hierarchy from high to low;
an element value obtaining sub-module 506, configured to obtain an element value of each form element in the target form;
the sequence value generation sub-module 507 is configured to use the element value of each tableelement as the sequence value of the structure object with the lowest hierarchy corresponding to the tableelement.
In practical applications, the preset naming rule may further include: element values of different data types, distinguished using different identifiers; accordingly, the sequence value generation sub-module 507 may specifically include: an element value type determining unit and a sequence value generating unit; wherein:
the element value type determining unit is used for determining the data type of the element value of each table element according to the preset corresponding relation between the identifier type and the data type;
and the sequence value generating unit is used for taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element according to the data type of the element value of each form element.
In practical applications, the format of the sequence data generated by the target form sequence module 404 includes: a JSON object format, a string format, an array format, or an XML format.
The present application also provides a computer-readable medium storing a program for causing a computer to execute a process for form serialization, the execution comprising the steps of:
an element name obtaining step, which is used for responding to a serialization instruction of a target form and obtaining the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
analyzing the hierarchical structure, namely analyzing the name of each form element to determine the preset hierarchical structure of the target form;
a target form serialization step of serializing the target form into sequence data reflecting the preset hierarchical structure.
Referring to fig. 6, a hardware architecture of a computer device provided by the present application is shown. The computer device is used for form serialization, and can be specifically a client. As shown in fig. 6, the computer device may specifically include: a system bus 601, a communication interface 602, a memory 603, and a processor 604.
A system bus 601 that couples the various hardware components of the computing device together.
The communication interface 602 is used to implement a communication connection between the computing device and at least one other computing device, such as a server, and may be implemented by using the internet, a wide area network, a local area network, a metropolitan area network, and the like.
A processor 603 for storing software programs and/or data.
A processor 604 for invoking data stored in the memory 603 by running a software program stored in the memory 603 to perform the following operations:
responding to a serialization instruction of a target form, and obtaining the name of each form element in the target form; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form;
analyzing the name of each form element to determine a preset hierarchical structure of the target form;
serializing the target form into sequence data reflecting the preset hierarchical structure.
For a specific flow of the above operations of the processor, reference may be made to the description of the form serialization method, which is not described herein again.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the same element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for serializing forms, comprising:
responding to a serialization instruction of a target form, and acquiring the target form with a preset hierarchical structure;
traversing each form element of the target form to obtain the name of each form element; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form; the preset naming rule comprises the following steps: the names of the form elements comprise a plurality of structural objects, the structural objects are separated by using a flag bit, and the front-back position relation of the structural objects is used for representing the high-low hierarchical relation of the structural objects;
analyzing the name of each form element according to the preset naming rule to determine a preset hierarchical structure of the target form;
serializing the target form into sequence data reflecting the preset hierarchical structure.
2. The form serialization method of claim 1, wherein said parsing the name of each form element according to the preset naming convention to determine the preset hierarchical structure of the target form comprises:
for the name of each form element, searching a flag bit in the name of the form element according to the sequence from front to back or from back to front;
when the flag bit is found, determining the levels of the structural object before and after the flag bit respectively; the hierarchy of the structural object before the flag bit is higher than that of the structural object after the flag bit, and the structural objects with high-low hierarchical relation are used for representing the preset hierarchical structure of the target form.
3. The form serialization method of claim 2, wherein the serializing the target form into sequence data reflecting the preset hierarchy comprises:
sequentially serializing the structural object of each table element according to a hierarchy from high to low;
acquiring the element value of each form element in the target form;
and taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element.
4. The form serialization method of claim 3, wherein the pre-set naming convention further comprises: element values of different data types, distinguished using different identifiers;
correspondingly, the taking the element value of each tableelement as the sequence value of the structure object with the lowest hierarchy corresponding to the tableelement comprises:
determining the data type of the element value of each table element according to the preset corresponding relation between the identifier type and the data type;
and according to the data type of the element value of each form element, taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element.
5. The form serialization method of claim 1, wherein the format of the sequence data comprises: a JSON object format, a string format, an array format, or an XML format.
6. A form serialization apparatus, comprising:
the target form acquisition module is used for responding to a serialization instruction of a target form and acquiring the target form with a preset hierarchical structure;
the element name acquisition module is used for traversing each form element of the target form to acquire the name of each form element; the names of the form elements are named according to a preset naming rule, and the preset naming rule is used for representing a preset hierarchical structure of the form; the preset naming rule comprises the following steps: the names of the form elements comprise a plurality of structural objects, the structural objects are separated by using a flag bit, and the front-back position relation of the structural objects is used for representing the high-low hierarchical relation of the structural objects;
the hierarchical structure analysis module is used for analyzing the name of each form element according to the preset naming rule so as to determine the preset hierarchical structure of the target form;
and the target form sequence module is used for serializing the target form into sequence data reflecting the preset hierarchical structure.
7. The form serialization apparatus of claim 6, wherein the hierarchy parsing module comprises:
the flag bit searching submodule is used for searching a flag bit in the names of the table elements according to the sequence from front to back or from back to front aiming at the names of the table elements;
a structure object hierarchy determining submodule, configured to determine, whenever the flag is found, hierarchies of a structure object before and after the flag respectively; the hierarchy of the structural object before the flag bit is higher than that of the structural object after the flag bit, and the structural objects with high-low hierarchical relation are used for representing the preset hierarchical structure of the target form.
8. The form serialization apparatus of claim 7, wherein the target form serialization module comprises:
the structure object generation submodule is used for sequentially serializing the structure object of each table element according to a hierarchy from high to low;
the element value acquisition submodule is used for acquiring the element value of each form element in the target form;
and the sequence value generation submodule is used for taking the element value of each tablesingle element as the sequence value of the structural object with the lowest hierarchy corresponding to the tablesingle element.
9. The form serialization apparatus of claim 8, wherein the pre-set naming convention further comprises: element values of different data types, distinguished using different identifiers;
accordingly, the sequence value generation submodule includes:
the element value type determining unit is used for determining the data type of the element value of each table element according to the preset corresponding relation between the identifier type and the data type;
and the sequence value generating unit is used for taking the element value of each form element as the sequence value of the structure object with the lowest hierarchy corresponding to the form element according to the data type of the element value of each form element.
10. The form serialization apparatus of claim 6, wherein the format of the sequence data generated by the target form serialization module comprises: a JSON object format, a string format, an array format, or an XML format.
CN201510850123.9A 2015-11-27 2015-11-27 Form serialization method and device Active CN106814998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510850123.9A CN106814998B (en) 2015-11-27 2015-11-27 Form serialization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510850123.9A CN106814998B (en) 2015-11-27 2015-11-27 Form serialization method and device

Publications (2)

Publication Number Publication Date
CN106814998A CN106814998A (en) 2017-06-09
CN106814998B true CN106814998B (en) 2020-08-25

Family

ID=59103588

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510850123.9A Active CN106814998B (en) 2015-11-27 2015-11-27 Form serialization method and device

Country Status (1)

Country Link
CN (1) CN106814998B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562777B (en) * 2017-07-17 2020-10-02 阿里巴巴集团控股有限公司 Data processing method and apparatus thereof
CN109408779B (en) * 2017-08-18 2023-03-17 北京华虹集成电路设计有限责任公司 Data processing method and device
CN108763546A (en) * 2018-05-31 2018-11-06 北京五八信息技术有限公司 A kind of conversion method of data format, device, storage medium and terminal
CN109710534B (en) * 2018-12-29 2022-01-11 北京航天云路有限公司 Form real-time monitoring and checking method and system based on custom attribute
CN112328230A (en) * 2020-11-18 2021-02-05 恩亿科(北京)数据科技有限公司 Json statement analysis method, system, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826112A (en) * 2010-05-05 2010-09-08 山东中创软件工程股份有限公司 Method, device and system for storing and reading list data
CN101834848A (en) * 2010-03-29 2010-09-15 北京航空航天大学 Method for describing protocol by using XML and protocol resolving system built by same
CN102473175A (en) * 2009-07-31 2012-05-23 惠普开发有限公司 Compression of XML data
CN102768674A (en) * 2012-06-12 2012-11-07 上海方正数字出版技术有限公司 XML (Extensive markup language) data storage method based on route structure
CN104216980A (en) * 2014-07-24 2014-12-17 英方软件(上海)有限公司 Classification method for serialized operations of file system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7941417B2 (en) * 2008-01-09 2011-05-10 Cisco Technology, Inc. Processing structured electronic document streams using look-ahead automata

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473175A (en) * 2009-07-31 2012-05-23 惠普开发有限公司 Compression of XML data
CN101834848A (en) * 2010-03-29 2010-09-15 北京航空航天大学 Method for describing protocol by using XML and protocol resolving system built by same
CN101826112A (en) * 2010-05-05 2010-09-08 山东中创软件工程股份有限公司 Method, device and system for storing and reading list data
CN102768674A (en) * 2012-06-12 2012-11-07 上海方正数字出版技术有限公司 XML (Extensive markup language) data storage method based on route structure
CN104216980A (en) * 2014-07-24 2014-12-17 英方软件(上海)有限公司 Classification method for serialized operations of file system

Also Published As

Publication number Publication date
CN106814998A (en) 2017-06-09

Similar Documents

Publication Publication Date Title
CN106814998B (en) Form serialization method and device
US7669119B1 (en) Correlation-based information extraction from markup language documents
US9607060B2 (en) Automatic generation of an extract, transform, load (ETL) job
US9047346B2 (en) Reporting language filtering and mapping to dimensional concepts
JP5756386B2 (en) Method, apparatus, and program for supporting generation and management of metadata for correcting problems of dynamic web application
US20040239674A1 (en) Modeling graphs as XML information sets and describing graphs with XML schema
US20220188104A1 (en) Microservices Graph Generation
CN102314497B (en) Method and equipment for identifying body contents of markup language files
TW201250492A (en) Method and system of extracting web page information
US7685114B2 (en) Systems and methods for mapping text
US20200175174A1 (en) Vulnerability Context Graph
US8788956B2 (en) Symbolic tree node selector
US11100069B2 (en) Element identification in a tree data structure
US9779135B2 (en) Semantic related objects
CN110968813A (en) Index page display method and device
US10031932B2 (en) Extending tags for information resources
CN106033387B (en) The method and apparatus for testing flash intrinsic controls
US9411792B2 (en) Document order management via binary tree projection
US7600186B2 (en) Generating a synonym dictionary representing a mapping of elements in different data models
CN111427577A (en) Code processing method and device and server
US20190005405A1 (en) Identifying a product in a document
US20220156245A1 (en) System and method for managing custom fields
US8694918B2 (en) Conveying hierarchical elements of a user interface
JP3914081B2 (en) Access authority setting method and structured document management system
US20120284224A1 (en) Build of website knowledge tables

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20180328

Address after: Cayman Islands Grand Cayman capital building a four storey No. 847 mailbox

Applicant after: CAINIAO SMART LOGISTICS HOLDING Ltd.

Address before: Cayman Islands Grand Cayman capital building a four storey No. 847 mailbox

Applicant before: ALIBABA GROUP HOLDING Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant