CN113961244A - Page conversion method, device, equipment and storage medium - Google Patents
Page conversion method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN113961244A CN113961244A CN202111575709.0A CN202111575709A CN113961244A CN 113961244 A CN113961244 A CN 113961244A CN 202111575709 A CN202111575709 A CN 202111575709A CN 113961244 A CN113961244 A CN 113961244A
- Authority
- CN
- China
- Prior art keywords
- converted
- file
- page
- conversion
- files
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/76—Adapting program code to run in a different environment; Porting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/151—Transformation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/51—Source to source
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Artificial Intelligence (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Document Processing Apparatus (AREA)
Abstract
The invention discloses a page conversion method, a page conversion device, page conversion equipment and a storage medium, and belongs to the technical field of computers. The method comprises the steps of acquiring a first storage directory where a page to be converted is located when a page conversion request is received; scanning all files in the first storage directory to obtain files to be converted; converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file; and generating the target conversion page according to the target conversion file. The invention solves the problems of large development workload and low working efficiency because incompatible files in the page need to be manually modified one by one when the page is converted at present, realizes the efficient automatic conversion of the page, reduces the development workload and improves the working efficiency.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a page conversion method, apparatus, device, and storage medium.
Background
When a Web (World Wide Web) application system is developed in the past, the development is mainly based on a NET Framework, and the NET Framework is a multi-language environment for running Web services and Windows application programs. Therefore, a NET Core framework is generated as soon as possible, and the NET Core can run on different operating systems, including Windows, linux and MacOS, so that cross-platform and cross-device are realized. Moreover, NET Core does not install Framework in advance when publishing the program, but downloads it through Nuget (a free software open source package management system), so that it does not install a complex and large Framework when first deploying, but downloads it as needed.
Based on the above advantages, and the requirement of cross-platform support, people begin to use NET Core to develop Web application systems. However, since the previous Web application systems are developed based on the NET Framework, it is necessary to modify these Web application systems into the NET Core version. Because part of pages in NET Core use cshtml extension files, and the aspx and ascx extension files used by part of pages in NET Framework are not supported, in order to realize the migration of an application system from NET Framework to NET Core version, part of pages in the original Web application system need to be converted. However, when the page is converted at present, incompatible files in the page need to be manually modified one by one, and the problems of large development workload and low working efficiency exist.
Disclosure of Invention
The invention mainly aims to provide a page conversion method, and aims to solve the problems that incompatible files in a page need to be manually modified one by one when page conversion is carried out at present, the development workload is large, and the working efficiency is low.
In order to achieve the above object, the present invention provides a page transformation method, device, apparatus and readable storage medium, wherein the page transformation method comprises the following steps:
when a page conversion request is received, acquiring a first storage directory where a page to be converted is located;
scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted;
converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file;
and generating the target conversion page according to the target conversion file.
Optionally, the step of scanning all the files in the first storage directory to obtain the file to be converted includes:
scanning all files in the first storage directory, and identifying the page to be converted in the first storage directory;
and filtering all files in the page to be converted according to a preset white list rule to obtain the file to be converted, wherein the white list rule is used for filtering the files which do not need to be converted in the page to be converted.
Optionally, after the step of filtering all the files in the page to be converted according to a preset white list rule, the method further includes:
and acquiring all the files which are not required to be converted and are filtered according to the white list rule in the page to be converted, and generating a list of the files which are not required to be converted according to the files which are not required to be converted.
Optionally, after the step of using the file to be converted after the node is successfully converted as the target conversion file, the method further includes:
acquiring all the target conversion files to generate a conversion success file list;
and acquiring the files to be converted, which are converted by all the nodes in failure, so as to generate a conversion failure file list.
Optionally, the converting each node that forms the file to be converted according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as a target conversion file includes:
identifying and analyzing the type of each node forming the file to be converted, and generating a structured document according to the type of each node;
and converting each node in the structured document according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as the target conversion file.
Optionally, before the step of converting each node in the file to be converted according to a preset mapping rule to generate a target conversion file, the method further includes:
acquiring a second storage directory where the preset mapping rule is located;
scanning the second storage directory to acquire a dynamic link library file containing the mapping rule;
and analyzing the dynamic link library file to obtain the mapping rule, wherein the mapping rule comprises a system rule and a user-defined rule, and the user-defined rule is a mapping rule defined in a pluggable mode, namely the mapping rule defined by the dynamic link library file comprising the user-defined rule is deleted or added.
Optionally, the step of generating the target conversion page according to the target conversion file includes:
acquiring a third storage directory where the target conversion page is located;
storing the target conversion file to the third storage directory;
and analyzing and rendering all files in the third storage directory after the target conversion file is stored, thereby generating the target conversion page.
In addition, to achieve the above object, the present invention provides a page converting apparatus, including:
the receiving module is used for acquiring a first storage directory where a page to be converted is located when a page conversion request is received;
the identification module is used for scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, and the file to be converted is converted into a preset target conversion page;
the conversion module is used for converting each node forming the file to be converted according to a preset mapping rule and taking the file to be converted after the node is successfully converted as a target conversion file;
and the rendering module is used for generating the target conversion page according to the target conversion file.
Optionally, the identification module is further configured to:
scanning all files in the first storage directory, and identifying the page to be converted in the first storage directory;
and filtering all files in the page to be converted according to a preset white list rule to obtain the file to be converted, wherein the white list rule is used for filtering the files which do not need to be converted in the page to be converted.
Optionally, the conversion module is further configured to:
identifying and analyzing the type of each node forming the file to be converted, and generating a structured document according to the type of each node;
and converting each node in the structured document according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as the target conversion file.
Optionally, the rendering module is further configured to:
acquiring a third storage directory where the target conversion page is located;
storing the target conversion file to the third storage directory;
and analyzing and rendering all files in the third storage directory after the target conversion file is stored, thereby generating the target conversion page.
Optionally, the apparatus further comprises:
the acquisition module is used for acquiring a second storage directory where the preset mapping rule is located;
scanning the second storage directory to acquire a dynamic link library file containing the mapping rule;
and analyzing the dynamic link library file to obtain the mapping rule, wherein the mapping rule comprises a system rule and a user-defined rule, and the user-defined rule is a mapping rule defined in a pluggable mode, namely the mapping rule defined by the dynamic link library file comprising the user-defined rule is deleted or added.
Optionally, the apparatus further comprises:
and the generating module is used for acquiring all the files which are not required to be converted and are filtered according to the white list rule in the page to be converted, and generating a list of the files which are not required to be converted according to the files which are not required to be converted.
Optionally, the generating module is further configured to:
acquiring all the target conversion files to generate a conversion success file list;
and acquiring the files to be converted, which are converted by all the nodes in failure, so as to generate a conversion failure file list.
The present invention also provides a page turning device, including: a memory, a processor and a page translation program stored on the memory and executable on the processor, the page translation program being configured to implement the steps of the page translation method as described above.
The invention also provides a storage medium, wherein the storage medium is stored with a page conversion program, and the page conversion program realizes the steps of the page conversion method when being executed by a processor.
The method comprises the steps of acquiring a first storage directory where a page to be converted is located when a page conversion request is received; scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted; converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file; and generating the target conversion page according to the target conversion file. The problems that incompatible files in a page need to be manually modified one by one when the page is converted at present, development workload is large, and working efficiency is low are solved. The efficient automatic conversion of the pages is realized, the development workload is reduced, and the working efficiency is improved.
Drawings
Fig. 1 is a schematic structural diagram of a terminal device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart diagram of an embodiment of the present invention;
fig. 3 is a detailed flowchart of an embodiment of step S30 in fig. 2.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context. The terms "or," "and/or," "including at least one of the following," and the like, as used herein, are to be construed as inclusive or mean any one or any combination.
It should be understood that, although the steps in the flowcharts in the embodiments of the present application are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, in different orders, and may be performed alternately or at least partially with respect to other steps or sub-steps of other steps.
In order to more clearly understand the technical features, objects, and effects of the present invention, embodiments of the present invention will now be described with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a terminal device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the terminal device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a data storage module, a network communication module, a user interface module, and a page conversion program.
In the terminal device shown in fig. 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the terminal device of the present invention may be provided in the terminal device, and the terminal device calls the page conversion program stored in the memory 1005 through the processor 1001 and performs the following operations:
when a page conversion request is received, acquiring a first storage directory where a page to be converted is located;
scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted;
converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file;
and generating the target conversion page according to the target conversion file.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
scanning all files in the first storage directory to obtain files to be converted, wherein the steps comprise:
scanning all files in the first storage directory, and identifying the page to be converted in the first storage directory;
and filtering all files in the page to be converted according to a preset white list rule to obtain the file to be converted, wherein the white list rule is used for filtering the files which do not need to be converted in the page to be converted.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
after the step of filtering all the files in the page to be converted according to a preset white list rule, the method further comprises the following steps:
and acquiring all the files which are not required to be converted and are filtered according to the white list rule in the page to be converted, and generating a list of the files which are not required to be converted according to the files which are not required to be converted.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
after the step of taking the file to be converted after the node is successfully converted as the target conversion file, the method further comprises the following steps:
acquiring all the target conversion files to generate a conversion success file list;
and acquiring the files to be converted, which are converted by all the nodes in failure, so as to generate a conversion failure file list.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as a target conversion file, wherein the method comprises the following steps:
identifying and analyzing the type of each node forming the file to be converted, and generating a structured document according to the type of each node;
and converting each node in the structured document according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as the target conversion file.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
before the step of converting each node in the file to be converted according to a preset mapping rule so as to generate a target conversion file, the method further comprises the following steps:
acquiring a second storage directory where the preset mapping rule is located;
scanning the second storage directory to acquire a dynamic link library file containing the mapping rule;
and analyzing the dynamic link library file to obtain the mapping rule, wherein the mapping rule comprises a system rule and a user-defined rule, and the user-defined rule is a mapping rule defined in a pluggable mode, namely the mapping rule defined by the dynamic link library file comprising the user-defined rule is deleted or added.
Further, the processor 1001 may be configured to call a page translation program stored in the memory 1005, and further perform the following operations:
generating the target conversion page according to the target conversion file, wherein the step comprises the following steps:
acquiring a third storage directory where the target conversion page is located;
storing the target conversion file to the third storage directory;
and analyzing and rendering all files in the third storage directory after the target conversion file is stored, thereby generating the target conversion page.
At present, when pages in an application system are converted, incompatible files in the pages need to be manually modified one by one. In the process, because the number of the incompatible files is large and the storage position is not fixed, when the files are manually modified, all the incompatible files need to be screened out from all the system files with large number, and then the files are manually modified one by one. Besides the problems of large development workload and low working efficiency, the method also has the problem of easy occurrence of errors and omissions.
In order to solve the above problem, the present invention provides a page conversion method, including: when a page conversion request is received, acquiring a first storage directory where a page to be converted is located; scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted; converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file; and generating the target conversion page according to the target conversion file. The method comprises the steps of scanning a first storage directory where a page to be converted is located to obtain a file to be converted; and then each node forming the file to be converted is converted according to the preset mapping rule, so that the modification of the incompatible file is completed, manual modification one by one is not needed, the efficient and automatic conversion of the page is completed, the development workload is reduced, the error rate is reduced, and the technical effect of improving the working efficiency is realized.
An embodiment of the present invention provides a page transformation method, and referring to fig. 2, fig. 2 is a schematic flowchart of an embodiment of a page transformation method according to the present invention.
In this embodiment, the page conversion method includes:
step S10: when a page conversion request is received, a first storage directory where a page to be converted is located is obtained.
In this embodiment, the page conversion means that one page can be converted into another page by converting a file in the page, for example, converting an aspx and ascx extension file in a WebForms page into a cshtml extension file, thereby converting the WebForms page into a Razor page; at this time, the WebForms page is the page to be converted.
The first storage directory is a file directory storing pages to be converted, wherein the file directory is used for facilitating access and management of thousands of files in a computer system, and the index of the files established by the computer system is a mapping relation between file names and file physical positions. When the page is converted, the folder name of the first storage directory where the page to be converted is located and the position of the folder name can be obtained by receiving the input directory input by the user. For example, the user enters a list of: d, myFile, the first storage directory acquired at this time is: d \\ \ myFile, which indicates that the folder name where the page to be converted is located is "myFile" and the position where the page to be converted is located is D disk.
Step S20: scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted.
In this embodiment, the preset target conversion page refers to a page that needs to be obtained when page conversion is performed, for example, when a WebForms page is converted into a Razor page, the target conversion page is the Razor page. The page to be converted is converted into a file to be converted of a preset target conversion page, that is, in the page conversion process, the file to be converted is incompatible with the target conversion page and needs to be modified, for example, when a WebForms page is converted into a Razor page, the file to be converted is an aspx and ascx extension file in the WebForms page, that is, the aspx and ascx extension file in the first storage directory needs to be acquired.
Optionally, in step S20, scanning all files in the first storage directory to obtain a file to be converted, where the step includes:
step S21, scanning all files in the first storage directory, and identifying the page to be converted in the first storage directory.
In this embodiment, since all the files in the first storage directory include some other system files besides the page to be converted, and these files do not need to be processed, only the page to be converted in the first storage directory needs to be identified.
And step S22, filtering all files in the page to be converted according to a preset white list rule to obtain the file to be converted, wherein the white list rule is used for filtering the files which do not need to be converted in the page to be converted.
In this embodiment, since many types of files are usually contained in the page to be converted, and only files that are not compatible with the target conversion page need to be converted, all files need to be filtered by using the white list rule. The white list rule is to filter all files by setting files which can not pass, namely, the filtered files are the files which do not need to be converted in the page to be converted, and the identified files are the files which need to be converted.
In the embodiment, all the files in the first storage directory are identified and filtered, so that the files to be converted in all the pages to be converted can be accurately obtained, the development workload is effectively reduced, and the occurrence of mistakes and omissions is favorably reduced.
Optionally, in step S22, after filtering all the files in the page to be converted according to a preset white list rule, the method further includes:
step S221, acquiring all the files which are not required to be converted and are filtered according to the white list rule in the page to be converted, and generating a list of the files which are not required to be converted according to the files which are not required to be converted.
In this embodiment, the non-conversion files include all the files except for the file to be converted in the page to be converted, and the non-conversion file list is to count the files and generate a list. By generating a list of files which do not need to be converted, the files can be clearly seen, the later maintenance work after the page conversion can be favorably finished, and if errors occur in the page conversion process, the missing and the defect repairing are convenient to check.
Step S30: and converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as a target conversion file.
In this embodiment, the preset mapping rule refers to a rule for converting each node constituting the file to be converted and each node constituting the target conversion file in a one-to-one correspondence manner, and is determined by the file to be converted and the target conversion file. The nodes are the minimum structural units forming the file, and have various types, such as file header information, server controls, style information, script information, embedded code blocks, comments and the like.
Step S40: and generating the target conversion page according to the target conversion file.
In this embodiment, according to the target conversion file obtained by conversion, in combination with other system files, the target conversion page can be finally generated by parsing and rendering the files through a browser.
Optionally, in step S40, generating the target conversion page according to the target conversion file includes:
step S41, obtain the third storage directory where the target conversion page is located.
In this embodiment, the third storage directory is a file directory where the target conversion page is located, and is used for storing the obtained target conversion file. By the output directory entered by the user when the page conversion request is received.
Step S42, storing the target conversion file in the third storage directory.
In this embodiment, the target conversion file can be stored in the third storage directory by newly creating a folder in the third storage directory and sending all the target conversion files to the newly created folder.
Step S43, parsing all the files in the third storage directory in which the target conversion file is stored, so as to generate the target conversion page.
In this embodiment, after the conversion of the file to be converted is completed, only the target conversion file is obtained, so that the target conversion page can be generated only by further parsing and rendering the files. The parsing and rendering refers to a process that a browser acquires and parses all files, and renders according to the files, so that the files are converted into a complete page.
In this embodiment, the obtained target conversion file is stored in the third storage directory, and then all files in the third storage directory are analyzed and rendered, so that the automatic conversion process of the final page is realized.
In the embodiment, when a page conversion request is received, a file to be converted is acquired, and the file to be converted is mapped according to the preset mapping
Converting each node forming the file to be converted according to the transmission rule to obtain a target conversion file, and converting each node according to the target conversion file
The target conversion file generates a target conversion page. The high-efficiency automatic conversion of the page is realized, so that the files to be converted are not required to be manually modified one by one when the page is converted, the development workload is reduced, the error rate can be effectively reduced, and the working efficiency is greatly improved.
Further, in another embodiment of the page conversion method of the present invention, step S30, converting each node constituting the file to be converted according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as a target conversion file, with reference to fig. 3, includes:
step S31, identifying and analyzing the type of each node forming the file to be converted, and generating a structured document according to the type of each node.
In this embodiment, the structuring refers to establishing a frame for the document, so that each part of the document is closely related according to a certain logical structure, wherein the structured document refers to generating the structured document according to the node type of all nodes forming the file to be converted, so as to facilitate the subsequent rapid conversion of all nodes.
Step S32, converting each node in the structured document according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as the target conversion file.
In the present embodiment, for better understanding, the following description is given by way of example, and reference is made to table 1, where table 1 is a table of preset mapping rules in an embodiment of the present invention. Assuming that the WebForms view page needs to be converted into a Razor page at this time, the preset mapping rule at this time is shown in table 1:
WebForms view page | Cshtml page | |
Header information | <%@%> | @ |
Server control | <asp:content /> | @section |
Style information | <link rel="stylesheet" /> | <app-css /> |
Script information | <script type="text/seajs" /> | <app-sea-js /> |
Embedded code block | <%%> | @{} |
Note | /* */ | @* *@ |
Custom control AppGrid | <cnt:AppGrid /> | <app-grid /> |
Custom control AppForm | <cnt:AppForm /> | <app-form /> |
TABLE 1
At this time, the file to be converted is an aspx and ascx extension name file in the WebForms view page, and then nodes such as file header information and server control of the aspx and ascx files are converted according to the middle mapping rule, for example: converting the file header information of the aspx file from "<% @>", to "@"; the annotation of the aspx file is converted from "/", to "@ and @", etc. And after all the nodes of the aspx and ascx files are converted successfully, obtaining a target conversion file, namely the cshtml extension file in the Razor page.
In the embodiment, a structured document is generated by identifying and analyzing the type of each node forming the file to be converted, and then all nodes in the structured document are converted according to the mapping rule, so that the rapid conversion of all nodes is realized, the conversion time is favorably reduced, and the conversion efficiency is improved.
Optionally, in step S32, converting each node in the structured document according to a preset mapping rule, and before taking the file to be converted after the node is successfully converted as the target conversion file, the method further includes:
step S321, obtaining a second storage directory where the preset mapping rule is located.
In this embodiment, the second storage directory is a file directory stored with a file containing a preset mapping rule.
Step S322, scanning the second storage directory to obtain the dynamic link library file containing the mapping rule.
In this embodiment, the dynamic link library file is a dll file, which is a file compiled by a user in advance according to the actual requirements of page conversion.
Step S323, parsing the dynamic link library file to obtain the mapping rule, where the mapping rule includes a system rule and a user-defined rule, and the user-defined rule is a mapping rule defined in a pluggable manner, that is, by deleting or adding the mapping rule defined by the dynamic link library file including the user-defined rule.
In this embodiment, the system rule refers to a mapping rule that must be defined to complete page conversion, and the custom rule is a mapping rule that is defined by a user according to the user's own needs, for example, a custom control may be added in the page conversion process, so as to add a required function in a page. Correspondingly, the system rule and the custom rule respectively have corresponding dll files, wherein the system rule file is necessary, and the custom rule file can be added according to actual requirements. The pluggable mode means that a mapping rule is defined by deleting or adding a file, that is, if a dll file containing a custom rule is added to the second storage directory, the mapping rule at this time contains a system rule and a custom rule, and the two rules need to be applied at the same time to complete the conversion of a page; if the dll file containing the custom rule is deleted in the second storage directory, only the system rule is applied to complete the conversion of the page.
In the embodiment, the file containing the preset mapping rule is stored in the second storage directory in advance, and the preset mapping rule file is compiled in advance according to actual requirements, so that different mapping rules can be preset for different page conversion requirements, thereby realizing conversion between different pages. In addition, the mapping rule can be customized in a pluggable mode, so that the required functions can be added into the page in the page conversion process in a control customization mode.
Further, in another embodiment of the page conversion method of the present invention, after the step of S30, taking the file to be converted after the node is successfully converted as the target converted file, the method further includes:
step S31, acquiring all the target conversion files to generate a conversion success file list.
In this embodiment, the target conversion file is the file to be converted after the node is successfully converted, and the files are counted, so as to generate a conversion success file list.
Step S32, acquiring the files to be converted that all nodes fail to convert, so as to generate a conversion failure file list.
In this embodiment, the conversion failure list is a list of files to be converted that have not been converted due to node conversion failure, and in order to ensure successful conversion of the page, the conversion failure list may be handed to a human for conversion. For better understanding, for example, there are 100 files to be converted, and among them, there are 90 files to be converted whose nodes are successfully converted, so as to obtain 90 target converted files, and the conversion successful file list at this time is the list generated by the 90 target converted files; the remaining ten files to be converted are not converted due to node conversion failure, and the conversion failure file list at this time is a list composed of the ten files to be converted.
According to the embodiment, the conversion success list and the conversion failure list are generated, so that when an error occurs in the automatic page conversion process, the file with the conversion failure can be accurately positioned, the successful completion of page conversion is ensured, meanwhile, due to the existence of the list, when maintenance work is carried out in the later period, manual modification and maintenance can be directly carried out according to the list, the workload is reduced, and the working efficiency is improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. 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 system that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A page conversion method is characterized by comprising the following steps:
when a page conversion request is received, acquiring a first storage directory where a page to be converted is located;
scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, which is required to be converted by converting the page to be converted into a preset target conversion page, in the page to be converted;
converting each node forming the file to be converted according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as a target conversion file;
and generating the target conversion page according to the target conversion file.
2. The page turning method according to claim 1, wherein said step of scanning all the files in said first storage directory to obtain the file to be turned comprises:
scanning all files in the first storage directory, and identifying the page to be converted in the first storage directory;
and filtering all files in the page to be converted according to a preset white list rule to obtain the file to be converted, wherein the white list rule is used for filtering the files which do not need to be converted in the page to be converted.
3. The page turning method according to claim 2, wherein after the step of filtering all the files in the page to be turned according to the preset white list rule, the method further comprises:
and acquiring all files which are not required to be converted and are filtered according to the white list rule in the page to be converted, and generating a list of the files which are not required to be converted according to the files which are not required to be converted.
4. The page turning method according to any one of claims 1 to 3, wherein after said step of using said file to be turned after the node is successfully turned as a target turned file, further comprising:
acquiring all the target conversion files to generate a conversion success file list;
and acquiring the files to be converted, which are converted by all the nodes in failure, so as to generate a conversion failure file list.
5. The page conversion method according to claim 4, wherein said converting each node constituting the file to be converted according to a preset mapping rule, and taking the file to be converted after the node is successfully converted as a target conversion file comprises:
identifying and analyzing the type of each node forming the file to be converted, and generating a structured document according to the type of each node;
and converting each node in the structured document according to a preset mapping rule, and taking the file to be converted after the nodes are successfully converted as the target conversion file.
6. The page turning method according to claim 5, wherein before the step of turning each node in the file to be turned according to a preset mapping rule to generate the target turned file, the method further comprises:
acquiring a second storage directory where the preset mapping rule is located;
scanning the second storage directory to acquire a dynamic link library file containing the mapping rule;
and analyzing the dynamic link library file to obtain the mapping rule, wherein the mapping rule comprises a system rule and a user-defined rule, and the user-defined rule is a mapping rule defined in a pluggable mode, namely the mapping rule defined by the dynamic link library file comprising the user-defined rule is deleted or added.
7. The page turning method of claim 6, wherein said step of generating said destination conversion page from said destination conversion file comprises:
acquiring a third storage directory where the target conversion page is located;
storing the target conversion file to the third storage directory;
and analyzing and rendering all files in the third storage directory after the target conversion file is stored, thereby generating the target conversion page.
8. A page turning apparatus, characterized in that the apparatus comprises:
the receiving module is used for acquiring a first storage directory where a page to be converted is located when a page conversion request is received;
the identification module is used for scanning all files in the first storage directory to obtain a file to be converted, wherein the file to be converted is a file to be converted, and the file to be converted is converted into a preset target conversion page;
the conversion module is used for converting each node forming the file to be converted according to a preset mapping rule and taking the file to be converted after the node is successfully converted as a target conversion file;
and the rendering module is used for generating the target conversion page according to the target conversion file.
9. A page turning apparatus, characterized in that the apparatus comprises: memory, a processor and a page translation program stored on the memory and executable on the processor, the page translation program being configured to implement the page translation method steps of any of claims 1-7.
10. A storage medium having stored thereon a page conversion program which, when executed by a processor, implements the steps of the page conversion method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111575709.0A CN113961244B (en) | 2021-12-22 | 2021-12-22 | Page conversion method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111575709.0A CN113961244B (en) | 2021-12-22 | 2021-12-22 | Page conversion method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113961244A true CN113961244A (en) | 2022-01-21 |
CN113961244B CN113961244B (en) | 2022-04-08 |
Family
ID=79473600
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111575709.0A Active CN113961244B (en) | 2021-12-22 | 2021-12-22 | Page conversion method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113961244B (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101976235A (en) * | 2010-09-21 | 2011-02-16 | 天津神舟通用数据技术有限公司 | Extensible Word report automatically-generating method based on dynamic web page |
JP2011053890A (en) * | 2009-09-01 | 2011-03-17 | Fujifilm Corp | Document link converting server, document link converting system and document link converting method |
CN102110196A (en) * | 2009-12-25 | 2011-06-29 | 中国长城计算机深圳股份有限公司 | Method and system for safely transmitting data among parallel-running multiple user operating systems |
CN102163233A (en) * | 2011-04-18 | 2011-08-24 | 北京神州数码思特奇信息技术股份有限公司 | Method and system for converting webpage markup language format |
US20140258258A1 (en) * | 2013-03-08 | 2014-09-11 | Kirk Steven Tecu | Method and system for file conversion |
CN110018984A (en) * | 2017-10-31 | 2019-07-16 | 北京国双科技有限公司 | A kind of conversion method and device of file format |
CN110083359A (en) * | 2019-03-20 | 2019-08-02 | 视联动力信息技术股份有限公司 | A kind of dispositions method and device |
CN110633251A (en) * | 2019-08-02 | 2019-12-31 | 深圳木成林科技有限公司 | File conversion method and equipment |
CN110795099A (en) * | 2019-09-03 | 2020-02-14 | 五八有限公司 | Page style conversion method and device, terminal equipment and storage medium |
CN111913695A (en) * | 2020-08-07 | 2020-11-10 | 国网信息通信产业集团有限公司 | Code conversion method, device and storage medium |
CN113254405A (en) * | 2021-06-01 | 2021-08-13 | 京东科技控股股份有限公司 | File conversion method, device, equipment and medium |
WO2021221856A1 (en) * | 2020-04-30 | 2021-11-04 | Microsoft Technology Licensing, Llc | Browser based visual debugging |
-
2021
- 2021-12-22 CN CN202111575709.0A patent/CN113961244B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011053890A (en) * | 2009-09-01 | 2011-03-17 | Fujifilm Corp | Document link converting server, document link converting system and document link converting method |
CN102110196A (en) * | 2009-12-25 | 2011-06-29 | 中国长城计算机深圳股份有限公司 | Method and system for safely transmitting data among parallel-running multiple user operating systems |
CN101976235A (en) * | 2010-09-21 | 2011-02-16 | 天津神舟通用数据技术有限公司 | Extensible Word report automatically-generating method based on dynamic web page |
CN102163233A (en) * | 2011-04-18 | 2011-08-24 | 北京神州数码思特奇信息技术股份有限公司 | Method and system for converting webpage markup language format |
US20140258258A1 (en) * | 2013-03-08 | 2014-09-11 | Kirk Steven Tecu | Method and system for file conversion |
CN110018984A (en) * | 2017-10-31 | 2019-07-16 | 北京国双科技有限公司 | A kind of conversion method and device of file format |
CN110083359A (en) * | 2019-03-20 | 2019-08-02 | 视联动力信息技术股份有限公司 | A kind of dispositions method and device |
CN110633251A (en) * | 2019-08-02 | 2019-12-31 | 深圳木成林科技有限公司 | File conversion method and equipment |
CN110795099A (en) * | 2019-09-03 | 2020-02-14 | 五八有限公司 | Page style conversion method and device, terminal equipment and storage medium |
WO2021221856A1 (en) * | 2020-04-30 | 2021-11-04 | Microsoft Technology Licensing, Llc | Browser based visual debugging |
CN111913695A (en) * | 2020-08-07 | 2020-11-10 | 国网信息通信产业集团有限公司 | Code conversion method, device and storage medium |
CN113254405A (en) * | 2021-06-01 | 2021-08-13 | 京东科技控股股份有限公司 | File conversion method, device, equipment and medium |
Non-Patent Citations (5)
Title |
---|
HENRY TAN等: "Razor: mining distance-constrained embedded subtrees", 《SIXTH IEEE INTERNATIONAL CONFERENCE ON DATA MINING - WORKSHOPS (ICDMW"06)》 * |
PHILOUSHKA: "WebformsToRazorPages", 《HTTPS://GITHUB.COM/PHILOUSHKA/WEBFORMSTORAZORPAGES》 * |
张振超: "Razor View Engine与ASPX View Engine引擎对比研究", 《电脑编程技巧与维护》 * |
涂刚等: "ASP.NET MVC的研究", 《软件工程师》 * |
郑行双: "基于MVC的Android与Web双模式教学平台的设计与实现", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 * |
Also Published As
Publication number | Publication date |
---|---|
CN113961244B (en) | 2022-04-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111241454B (en) | Method, system and device for generating webpage codes | |
CN109840083B (en) | Webpage component template construction method and device, computer equipment and storage medium | |
CN110705237B (en) | Automatic document generation method, data processing device and storage medium | |
US11003835B2 (en) | System and method to convert a webpage built on a legacy framework to a webpage compatible with a target framework | |
CN102163233A (en) | Method and system for converting webpage markup language format | |
CN114424257A (en) | Automatic rendering and extraction of form data using machine learning | |
CN101751461A (en) | Document conversion method and device | |
US20100082954A1 (en) | Configuration rule prototyping tool | |
CN110780860A (en) | Generation method and device of table building script, computer equipment and storage medium | |
CN110928802A (en) | Test method, device, equipment and storage medium based on automatic generation of case | |
CN104731588B (en) | Page layout document generating method and page layout file creating apparatus | |
CN111068328A (en) | Game advertisement configuration table generation method, terminal device and medium | |
CN113434133B (en) | Application building method, device, equipment and computer readable storage medium | |
CN105589959A (en) | Form processing method and form processing system | |
CN111459537A (en) | Redundant code removing method, device, equipment and computer readable storage medium | |
CN109062906B (en) | Translation method and device for program language resources | |
CN108664247B (en) | Page template data interaction method and device | |
CN104346398A (en) | Method and device for automatically filling and submitting data on line | |
CN112947900B (en) | Web application development method and device, server and development terminal | |
CN105094787B (en) | Method and device for processing enterprise internet application | |
CN113360139A (en) | Integration method and device of front-end frame, electronic equipment and storage medium | |
CN113296752A (en) | Method, system, device and storage medium for generating API document | |
CN113961244B (en) | Page conversion method, device, equipment and storage medium | |
US20190171648A1 (en) | System and method for implementing an extract transform and load (etl) migration tool | |
CN116432624A (en) | Micro-service API document generation method, device, equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |