File processing method and device

By adding a parsing method for the second format file to the file reader, the problem of being unable to parse files in the existing technology is solved, and paging reading and scrolling left and right pages are realized, improving the user's reading experience.

CN114372028BActive Publication Date: 2025-06-06SHANGHAI HEHEHE CULTURE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210038611.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-13
Publication Date
2025-06-06
Estimated Expiration
2042-01-13

AI Technical Summary

Technical Problem

Existing file readers cannot parse files of different formats, especially paging reading and scrolling left and right pages, and the layout rendering effect of graphic and text labels is not ideal, affecting the user's reading experience.

Method used

By adding a parsing method to the second format file in the file reader, a label list is obtained by parsing the file to be displayed, a label data list is created based on the label list and the first format, and a label content information is displayed in the file reader based on the label attribute information.

Benefits of technology

It realizes parsing files of different formats, supports pagination reading and scrolling left and right pages, improves the layout and rendering effect of graphic and text labels, and improves the user's reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114372028B_ABST
    Figure CN114372028B_ABST
Patent Text Reader

Abstract

The present application provides a file processing method and device, wherein the file processing method includes: receiving a file display instruction, and obtaining a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format; parsing the file to be displayed to obtain a tag list; creating a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information; and displaying the tag content information in the file reader based on the tag attribute information. The file processing method of the present application, by adding a parsing method for files in the second format to an existing file reader, enables files in the second format to be displayed in the file reader, thereby improving the compatibility of the file reader; by displaying the tag content information through the tag attribute information, the display form of the tag content information is enriched, and the user's reading experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a file processing method, a file processing device, a computing device, and a computer-readable storage medium. Background Art

[0002] With the continuous development of computer technology, more and more users use online reading to read books of interest; in order to meet the different reading needs of users, reading files in different file formats are usually used, such as comic files in jpg and webp image formats, novel files in epub format, etc. Taking epub format files as an example, in order to identify the html content in epub format files, reading software usually uses the WebView method to parse, render and display the html content in epub format files; or use different readers for books with different contents, such as comic readers for comic content and novel readers for novel content.

[0003] However, the above method of using WebView to parse files can only read the file content by vertical scrolling, and cannot scroll left and right to turn pages. In addition, for some graphic labels, they rely on CSS styles, and the layout rendering effect is not ideal, which can easily cause a poor reading experience for users. The method of creating multiple readers is more cumbersome, which affects the efficiency of file processing and parsing.

[0004] Therefore, how to realize paged reading of file contents and how to use the same reader to parse multiple types of files have become technical problems that need to be solved urgently by those skilled in the art. Summary of the invention

[0005] In view of this, an embodiment of the present application provides a file processing method. The present application also relates to a file processing device, a computing device, and a computer-readable storage medium to solve the problem that the file reader in the prior art cannot parse files of different formats.

[0006] According to a first aspect of an embodiment of the present application, a file processing method is provided, comprising:

[0007] receiving a file display instruction, and acquiring a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format;

[0008] Parsing the file to be displayed to obtain a tag list;

[0009] Creating a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information;

[0010] The tag content information is displayed in the file reader based on the tag attribute information.

[0011] According to a second aspect of an embodiment of the present application, there is provided a file processing device, including:

[0012] a receiving module, configured to receive a file display instruction, and obtain a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format;

[0013] A parsing module, configured to parse the to-be-displayed file to obtain a tag list;

[0014] A creation module, configured to create a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information;

[0015] The display module is configured to display the tag content information in the file reader based on the tag attribute information.

[0016] According to a third aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the file processing method when executing the computer instructions.

[0017] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, and when the computer instructions are executed by a processor, the steps of the file processing method are implemented.

[0018] The file processing method provided by the present application receives a file display instruction, and obtains a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format; parses the file to be displayed to obtain a tag list; creates a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information; and displays the tag content information in the file reader based on the tag attribute information.

[0019] An embodiment of the present application realizes that by adding a parsing method for files in the second format to an existing file reader, files in the second format can also be displayed in the file reader, thereby improving the compatibility of the file reader; tag content information is displayed through tag attribute information, thereby enriching the display form of tag content information and improving the user's reading experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flowchart of a file processing method provided by an embodiment of the present application;

[0021] Figure 2 is a processing flow chart of a file processing method applied to a comic reader provided by an embodiment of the present application;

[0022] Figure 3 This is a process flow chart for creating a page data list provided by an embodiment of the present application;

[0023] Figure 4 This is a processing flow chart of rendering tag content information provided by an embodiment of the present application;

[0024] Figure 5 is a structural schematic diagram of a file processing device provided by an embodiment of the present application;

[0025] Figure 6 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0026] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0027] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to any or all possible combinations of one or more associated listed items.

[0028] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0029] First, the terms involved in one or more embodiments of the present application are explained.

[0030] epub (Electronic Publication): An electronic book standard with a file extension of .epub. This format is a compressed package that has a good display for rich media such as graphics, text, and tables. It expresses chapter content based on HTML format files.

[0031] Rich media: refers to information dissemination methods with animation, sound, video or interactivity; rich media includes one or a combination of streaming media, sound, Flash, Java and other programming languages.

[0032] Tag: that is, HTML tag. HTML tag is the most basic unit in HTML language and the most important component of HTML.

[0033] Light novel: a genre of fiction that uses pictures and text as information carriers to express stories.

[0034] HTML: Hypertext Markup Language, which uses a series of tags to describe rich media information such as pictures, texts, tables, hyperlinks, etc.

[0035] WebView: A technical solution for parsing web page HTML, rendering content information, and interacting on mobile Android and IOS platforms.

[0036] At present, readers usually use the following three methods to parse epub format files: First, use WebView to read the HTML chapter content and parse and render it. The reading method of WebView is scrolling within the chapter. This solution for reading light novels mainly relies on the WebView kernel; second, use a scrolling list to read the HTML chapter content and then parse and render it. This method mainly renders in text style and is a reader with a single rendering style; third, books with different contents use different readers, such as comic content using a comic reader and light novel content using a light novel reader.

[0037] However, existing light novel readers mainly use WebView for rendering. The epub file content needs to be parsed first to obtain HTML and CSS styles, then the layout is calculated through CSS styles and the size of the mobile phone screen, and finally rendered. This method can only be read in vertical scrolling mode, and cannot be paginated or scrolled left and right. For some graphic tags, they rely on CSS styles, and the layout rendering effect is not ideal; secondly, readers with a single rendering style lose the rich media expression form; thirdly, they cannot coexist with readers with other content forms (such as comic readers).

[0038] In response to the above problems, the present application adopts a file processing method, which abstracts and converts the tag tree parsed from the chapter content of the epub file into tag segment data, and paginates the tag segment data to obtain page data, so that the HTML content in the epub file can be paginated on a mobile phone, and the pages can be scrolled left and right; based on the existing comic reader, the epub format file is embedded in the comic reader in the form of page data, so that the title, pictures, annotations, hyperlinks and other elements in the book can be better typeset, maintain its rich media characteristics, provide rich media rendering effects, and improve the user reading experience.

[0039] In the present application, a file processing method is provided. The present application also relates to a file processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0040] Figure 1 A flowchart of a file processing method provided according to an embodiment of the present application is shown. The file processing method is applied to a file reader, and the file reader is used to display a file in a first format, and specifically includes the following steps:

[0041] Step 102: Receive a file display instruction, and obtain a file to be displayed based on the file display instruction, wherein the file to be displayed is in the second format.

[0042] The current file reader can only parse and display files of certain file formats. For example, the comic reader can only parse and display comic files in image formats such as jpg and webp. After the file processing method in this embodiment is applied to the file reader, the types of file formats that the file reader can process can be increased. For example, the current file reader can only parse and display files in image formats such as jpg and webp. Through the file processing method in this embodiment, the file reader can also parse and display files in epub format.

[0043] Specifically, the file display instruction refers to an instruction to display the file to be displayed in the file reader; the file reader refers to a data processing module or application that can parse and display files; the file to be displayed refers to a file that needs to be displayed in the file reader; the first format refers to a file format in which the file reader can directly recognize the file content; the second format refers to a file format that is different from the first format and is obtained by the file reader when processing the file through the file processing method of this embodiment, but the file reader can parse and display the HTML content in the file.

[0044] In actual application, the file reader receives the file display instruction, determines the file identifier in the file display instruction, and determines the file to be displayed in the second format based on the file identifier.

[0045] In a specific implementation of the present application, taking a comic reader as an example, the comic reader can directly identify comic files in jpg format, parse and display the comic files in the comic reader; the comic reader receives a file display instruction, and determines that the file identifier in the file display instruction is "light novel"; based on the file identifier, it is determined that the file to be displayed is a light novel file, and the file format of the light novel file is epub format.

[0046] By receiving the file display instruction, it is convenient to determine the to-be-displayed file that needs to be displayed in the file reader based on the file identifier in the file display instruction.

[0047] Step 104: Parse the file to be displayed to obtain a tag list.

[0048] Most of the files displayed in the reader are compressed files, and it is necessary to decompress the compressed files to determine the specific content in the files. This embodiment mainly parses files with more tag content to determine the tag content in the files. The specific file decompression method is not specifically limited in this application. For example, HTML tag data, image data, text data, etc. are obtained by decompressing files in epub format. In order to facilitate further processing of the content parsed in the file, the parsed data can be abstracted into class field data, that is, the data is converted into objects in a programming language for description. For example, a novel in epub format is parsed, and the parsed data (for example, author name, chapter list, chapter content, CSS, pictures, etc.) is abstracted into class field data.

[0049] The tag list refers to a data table consisting of tags parsed from the file to be displayed.

[0050] In practical applications, the specific method of parsing the to-be-displayed file to obtain the tag list includes:

[0051] Parsing the file to be displayed to obtain a tag set;

[0052] In a case where the tags in the tag set are of a first tag structure, the tags of the first tag structure are converted into tags of a second tag structure, and a tag list is generated based on the tags of the second tag structure.

[0053] Among them, the tag set refers to a set of tags parsed from the file to be displayed; the first tag structure refers to the original tag node relationship information between tags in the tag set; the second tag structure refers to the tag node relationship information between tags in the tag set that is different from the original tag node relationship information.

[0054] In actual applications, since there is tag structure relationship information in the tags obtained by parsing the file to be displayed, it is necessary to remove the tag structure relationship information in the tags to determine all tags in the file to be displayed.

[0055] For example, each tag in the tag set is parsed to obtain its tree-like tag structure relationship; the tree-like structure relationship is converted into a planar tag structure relationship, that is, tag nodes with parent-child relationships are converted into tag nodes with linear relationships, and a tag list is formed based on the tags with linear relationships.

[0056] In practical applications, a specific method for converting a tag of the first tag structure into a tag of the second tag structure includes:

[0057] Determine a target tag in the tag set;

[0058] Based on a preset traversal rule, the tags in the tag set are traversed with the target tag as a starting tag to obtain tags of a second tag structure.

[0059] Among them, the target tag is one of the tags in the tag set, for example, the target tag is the root tag in the tag set; the preset traversal rule refers to the rule for traversing the tags in the tag set, for example, the preset traversal rule is the pre-order traversal rule, the layer-order traversal rule, the subsequent traversal rule, the depth-first rule, etc., or a combination rule composed of two or more of the aforementioned rules, etc.; the starting tag refers to the first traversed tag when performing tag traversal.

[0060] Specifically, the target tag can be determined in the tag set based on the preset traversal rules. Taking the pre-order traversal rule as an example, the pre-order traversal rule is to traverse downward from the root tag, so the root tag in the tag set is determined as the target tag based on the pre-order traversal rule; when performing a pre-order traversal on the tags in the tag set, the traversal starts from the determination of the target tag until all the tags in the tag set are traversed.

[0061] In a specific implementation of the present application, taking a novel file as an example, the novel file is parsed to obtain a tag set; the tag set is parsed to determine its tree-like tag structure relationship; the preset traversal rule is determined to be a pre-order traversal algorithm and a depth-first principle, and then the root tag in the tag set, tag 1, is determined according to the preset traversal rule; starting from tag 1, each tag in the tag set is traversed based on the pre-order traversal algorithm and the depth-first principle to obtain a planar tag structure relationship; the tags are stored in a tag list in the order of traversal, and the traversal of the tags in the novel file is completed.

[0062] By parsing the file to be displayed, the data in the file to be displayed is determined, and the parsed data is abstracted into class field data to facilitate further processing of the tag; the tag is parsed to obtain its tag structure relationship, and the tree-like tag structure relationship is converted into a planar tag structure relationship through traversal, thereby improving the processing efficiency of the subsequent file reader for the file to be displayed.

[0063] Step 106: Create a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information.

[0064] In order for the file reader to parse and display the file to be displayed in the second format, the data in the second format in the file to be displayed needs to be converted into the first format.

[0065] The tag data list refers to a data table consisting of tags in the first format; the tag content information refers to the content information in the tag, for example, the title tag <h1> The tag content in is the article title; the tag attribute information refers to the attribute information corresponding to the tag, for example, the title tag< / h1> <h2> The tag attribute is the title tag< / h2> <h2>The corresponding css style information.

[0066] In practical applications, a specific method for creating a label data list according to the label list and the first format includes:

[0067] Determine a tag classification type of each tag in the tag list, wherein the tag classification type includes a non-text tag type and a text tag type;

[0068] In a case where the tag in the tag list is of the non-text tag type, creating first tag segment data based on the first sub-format and the tag list;

[0069] When the tag in the tag list is of the text tag type, creating second tag segment data based on a second sub-format and the tag list;

[0070] The label data list is generated based on the first label segment data and the second label segment data.

[0071] The tag classification type refers to the classification type determined based on the parsing requirements for the file to be displayed. The tag classification type includes non-text tag type and text tag type. The non-text tag type refers to a tag type that does not have a parent tag or meets the format conversion requirements and can be directly converted to a second format, such as a title tag.< / h2> <h1> If there is no parent tag, you can put the title tag< / h1> <h1>As a non-text type of label, for example, a segment label If it meets the format conversion requirements and can be directly converted into a second format as a piece of content, then the segment tag A non-text tag type. A text tag type refers to a tag type that has a parent tag and multiple text content tags under the parent tag, such as a hyperlink tag. There is a parent tag that is a title tag < / h1> <h1> , and the title tag <h1> Also contains bold text labels , emphasized text label <em> etc., you can add the hyperlink tag< / em> <em> A label as a text label type; the first format includes a first sub-format and a second sub-format, wherein the first sub-format refers to the format of a label of a non-text label type, and the second sub-format refers to the format of a label of a text label type; the first label segmentation data refers to label segmentation data containing only one label segmentation element; the second label segmentation data refers to label segmentation data that may contain multiple label segmentation elements.

[0072] Specifically, in order to convert the file to be displayed in the second format into the first format that can be displayed by the file reader, the file processing method in this embodiment divides the tags parsed from the file to be displayed into two categories, one of which is a non-text tag type, for example, a block tag. , Segment Label , first level title tag <h1> , Second level title tag< / h1> <h2>, List Tags , ordered list tags , Unordered list tags , Image Tags There are no parent tags or tags that meet the format conversion requirements. The other type is the text tag type, for example, the hyperlink tag , bold text label , emphasized text label <em>, italic text label There is a parent tag and multiple text content tags under the parent tag.

[0073] After determining the label classification type of the label, create first label segmentation data based on the first sub-format corresponding to the non-text label type, and create second label segmentation data based on the second format corresponding to the text label type; assemble the created first label segmentation data and second label segmentation data in sequence to obtain a label data list.

[0074] Furthermore, when the tag in the tag list is of the non-text tag type, a specific method for creating first tag segment data based on the first sub-format and the tag list includes:

[0075] Determining label content information, label type information, and label attribute information of the label;

[0076] The tag content information, tag type information, and tag attribute information are stored based on the first sub-format to obtain first tag segment data.

[0077] The tag content information refers to the content contained in the tag, for example, the title tag <h1>The tag content in is "novel author name"; the tag type information refers to the specific type of the tag, for example, Tags are used to identify images and are image type tags. For example,< / h1> <h1>Used to identify the first-level text title, which is a text type tag; tag attribute information refers to the style information of the tag, for example, the CSS style information corresponding to the tag, and image attribute information such as the image display size information of the image tag.

[0078] Specifically, for example, based on the title tag without a parent tag< / h1> <h1> , that is, title tags based on non-text tag types< / h1> <h1> Creating the first tag segment data includes: creating new tag data 1, wherein the new tag data 1 includes a tag data content field, a tag data type field, and a tag data attribute field, and the field content is empty; obtaining a title tag< / h1> < / em> <em> <h1> The label content information, label type information and label attribute information in the new label data 1 are set; the label content information is set to the label data content in the new label data 1, the label type information is set to the label data type in the new label data 1, and the label attribute information is set to the label data attribute in the new label data 1 to complete the creation of the new label data 1; the new label data 1 is added to the label data list.

[0079] For example, segment tags There is a parent tag, but the segment tag Meet the format conversion requirements, that is, the segment label can be Directly convert to the second format, so the segment label Treated as non-text type tags, based on segment tags Creating the first tag segment data includes: creating new tag data 2, wherein the new tag data 2 includes a tag data content field, a tag data type field, and a tag data attribute field, and the field content is empty; obtaining a segment tag The label content information, label type information and label attribute information in the new label data 2 are set; the label content information is set to the label data content in the new label data 2, the label type information is set to the label data content in the new label data 2, and the label attribute information is set to the label data attribute in the new label data 2 to complete the creation of the new label data 2; the new label data 2 is added to the label data list.

[0080] Furthermore, when the tag in the tag list is of the text tag type, a specific method for creating second tag segment data based on the second sub-format and the tag list includes:

[0081] Determine the parent tag of the tag, and determine the child tag corresponding to the parent tag;

[0082] Obtaining tag content information, tag type information, and tag attribute information of each sub-tag;

[0083] Based on the tag content information, tag attribute information of each sub-tag, tag type information of the parent tag and the second sub-format, a tag segmentation element corresponding to each sub-tag is formed;

[0084] The second tag segment data corresponding to the parent tag is formed according to each tag segment element.

[0085] A parent tag is a tag that has at least one child tag nested inside it. For example, Nested in ,but Can be called The parent tag of for A subtag of a tag; a tag segmentation element refers to a segmentation element created based on a subtag.

[0086] Specifically, when it is determined that the target tag in the tag set is a text tag type, the parent tag of the target tag is determined; based on the parent tag, all the child tags in the parent tag are determined, and the tag content information, tag attribute information and tag type of one of the child tags are obtained to form a tag segmentation element; based on each child tag, a tag segmentation element corresponding to each child tag is generated, and the tag type information in each tag segmentation element is the tag type information of the parent tag; the second tag segmentation data corresponding to the parent tag is composed of the tag segmentation elements corresponding to each child tag obtained.

[0087] For example, based on the presence of a parent tag <h1>Sub-tags of Creating the second label segment data includes: determining the label The parent tag of <h1> , and determine< / h1> <h1>All subtags of 、 ; Get labels separately And tags Tag content information and tag attribute information, as well as obtaining the parent tag <h1> Tag type information; based on tags Tag content information, tag attribute information and parent tag <h1> Create a label segmentation element 1 based on the label type information of the label Tag content information, tag attribute information and parent tag <h1> The tag type information creates tag segment element 2; the parent tag is composed of tag segment element 1 and tag segment element 2.< / h1> <h1>The corresponding second tag segment data.

[0088] By creating tag segmentation data that conforms to the tag classification type for different tags, it is convenient to display the file content based on the tag segmentation data in different formats, thereby improving the subsequent layout richness of the file content and further improving the user's reading experience.

[0089] Step 108: Displaying the tag content information in the file reader based on the tag attribute information.

[0090] When displaying the label content in a file, in addition to considering the file format, you must also determine the display settings of the file reader that displays the file, including the position information, size information, etc. when the text reader displays the file, so that the content in the file can be more completely displayed in the file reader.

[0091] In practical applications, displaying the tag content information in the file reader based on the tag attribute information specifically includes:

[0092] Obtaining display setting information of the file reader;

[0093] The tag content information is presented in the document reader based on the display setting information and the tag attribute information.

[0094] Among them, the display setting information refers to the display setting information of the file reader, which may include but is not limited to display size information, display position information, etc.; according to the display setting information, the display area where the file content can be displayed in the file reader under the current display settings can be determined, and according to the tag attribute information, the size, style and other information of the tag content in the tag can be determined. Based on the display setting information and the tag attribute information, it can be determined which tags can be displayed completely together by the current file reader.

[0095] Furthermore, a specific method for displaying the tag content information in the file reader based on the display setting information and the tag attribute information includes:

[0096] Creating a page data list based on the display setting information and the tag attribute information;

[0097] The tag content information is displayed according to the page data list.

[0098] Among them, the page data list refers to a data table containing page data; according to the display setting information and the tag attribute information, the tags that can be fully displayed in one page by the file reader can be determined, and the tags that can be fully displayed in one page are stored as a page data, so that the page data list can be composed of multiple page data.

[0099] Specifically, the process of creating a page data list based on the display setting information and the tag attribute information includes:

[0100] Determine the preset page data list;

[0101] Determine whether the preset page data list contains a page element, and obtain a determination result;

[0102] Based on the judgment result and the display setting information, the tag data list is traversed to obtain at least one page data, wherein the page data includes page elements;

[0103] A page data list is generated according to the at least one page data and the preset page data list.

[0104] The preset page data list refers to a pre-created data table that may or may not contain page data; the page element refers to an element used to constitute page data; and the page data refers to data composed of at least one page element.

[0105] For example, determine page data list A, where page data list A is an empty data list; determine whether page data list A contains page elements and obtain a determination result; traverse the tag data in the tag data list based on the determination result and display setting information of the file reader, and convert the tag data into page elements in the page number, where page data is composed of page elements that can be displayed in one page; and add the page data to page data list A accordingly.

[0106] Under different judgment results, different methods are used to determine the starting position when traversing the tag data list.

[0107] In the case where the judgment result is that the page data list contains page elements, a specific method of traversing the tag data list based on the judgment result and the display setting information includes:

[0108] If the judgment result is yes, determining a target page element in the preset page data list, and using the coordinate information of the target page element as the starting coordinate information;

[0109] The tag data list is traversed based on the starting coordinate information and the display setting information.

[0110] Among them, the target page element refers to one of the page elements in the page data list. The preset page data list may contain page data, and each page data contains page elements. When the preset page data list contains a page data list, the last page element located on the last page can be used as the target page element; the starting coordinate information refers to the specific value of the starting coordinate when traversing the label data list.

[0111] After determining the starting coordinate information, the starting position of the traversal can be determined; the label data list is traversed from the starting position, that is, which page elements can be displayed in the current page. If the current page cannot fully display the page elements, new page data can be created in the page data list, and page elements can be added to the newly created page data until all label segment data in the label data list are traversed.

[0112] By using the coordinate information of the target page element as the starting coordinate information during traversal, the layout of the page elements on the current page is realized. When it is no longer possible to add label segment data to the current page, new page data is created to achieve continuous and paginated display of the label content, thereby improving the user's viewing experience.

[0113] In the case where the judgment result is that the page data list does not contain page elements, a specific method of traversing the tag data list based on the judgment result and the display setting information includes:

[0114] If the judgment result is no, determining the preset element coordinates in the preset page data list, and using the preset element coordinates as the starting coordinate information;

[0115] The tag data list is traversed based on the starting coordinate information and the display setting information.

[0116] The preset element coordinates refer to preset coordinate information. For example, the preset element coordinates are the coordinates of a position close to the upper left corner of the file display page.

[0117] When creating a preset page data list, initialization is required, including setting the preset element coordinates; based on the preset element coordinates, it can be determined from which position in the page to start displaying the file content, thereby facilitating subsequent rendering and display of the file content.

[0118] After determining the preset element coordinates, the preset element coordinates are used as the starting coordinate information; the label data list is traversed according to the starting coordinate information and the display setting information until all the label segment data in the label data list are traversed.

[0119] In actual applications, the tag data list can be traversed through the judgment results and display setting information to obtain the page data.

[0120] Specifically, the method of traversing the tag data list based on the judgment result and the display setting information to obtain at least one page data includes S1082 to S1086:

[0121] S1082: Determine the tag type information of the tag segment data in the tag data list, and determine index information, coordinate information, belonging tag type information and belonging tag content information based on the tag type information and the starting coordinate information.

[0122] S1084: Create a page element based on the index information, coordinate information, tag type information, and tag content information.

[0123] S1086: Determine start index information and end index information according to the display setting information and the tag attribute information of the tag segment data, and create page data based on the page element, the start index information and the end index information.

[0124] Among them, index information refers to the identification information of the page element in the page data, which can be an ID number, serial number, etc. that uniquely identifies the page element. For example, the index information of page element 1 is the ID "123" of page element 1; coordinate information refers to the coordinate information of the page element when it is displayed on the page; the tag content information refers to the content information of the page element obtained in the tag segment data; the tag type information refers to the type information of the page element obtained in the tag segment data.

[0125] Specifically, a page element is created in the page data list based on the acquired index information, coordinate information, tag type information, and tag content information.

[0126] The display setting information refers to the display setting information of the file reader. In this embodiment, in order to determine the specific display area, in addition to directly obtaining the display setting information, the screen size information and screen spacing value of the terminal running the file reader can also be obtained, and the specific displayable area is calculated based on the screen size information and the screen spacing value.

[0127] According to the size information of the display area and the attribute information of the label data, the page elements that can be fully displayed on the screen are determined to form a page element set; the index information of the first page element in the page element set, i.e., the starting index information, and the index information of the last page element, i.e., the ending index information, are determined; and page data is generated based on all the page elements in the page element set as well as the starting index information and the ending index information.

[0128] For example, the tag data list L is traversed, an empty page data list is created and the default traversal starting coordinates are determined to be the coordinate information K; when the tag segment data B in the tag data list L is traversed, the tag type information of the tag segment data B is obtained as the text type; the text content length information of the tag segment data B is obtained according to the text type, and the text content information is obtained based on the text length information; the font size information of the tag segment data B is obtained, and the font width and height information of the text content is calculated based on the font size information; according to the font width and height information and the display area, it is determined that the tag segment data B can be displayed in the current display area, and the coordinate information of the tag segment data B when displayed in the display area is calculated; the text content information of the tag segment data B is used as the tag content information, and the tag type information of the tag segment data B is used as the tag type information, and a page element b is created according to the tag content information, the tag type information and the coordinate information, and the page element b is added to the page data, and an element ID that can uniquely identify the page element b is set for the page element b (that is, the index information of the page element is generated), and the traversal of the tag segment data B is completed.

[0129] If it is determined through the coordinate information and the size information of the display area that the display area can only fully display the label segment data A and the label segment data B, then the page data 1 includes the page element a corresponding to the label segment data A and the page element b corresponding to the label segment data B; when traversing to the label segment data C, it is necessary to create a new page data 2 to store the page element c corresponding to the label segment data C.

[0130] For another example, when traversing to the label segment data P of the label data list M, the label type of the label segment data P is obtained as a picture type; based on the picture type, the picture size information in the label segment data is determined. When the picture size information exceeds the remaining display area in the current display area, the picture can be scaled proportionally, or a new page data can be created to store the page element p of the label segment data P.

[0131] In actual applications, in addition to the above-mentioned text types and picture types, other types such as titles, comments, hyperlinks, etc. can also be processed into corresponding page elements and stored in the corresponding page data; by traversing each tag segment data in the tag data list until the traversal of each tag segment data is completed and the corresponding page elements are added, a complete page data list is finally obtained.

[0132] After obtaining the page data list, it is necessary to render the tag content information based on the page data list, that is, to render the tag content information belonging to the page element, specifically including:

[0133] The tag content information is rendered based on the page data list.

[0134] Specifically, obtain the page data in the page data list and determine the page elements in the page number; obtain the tag attribute information when rendering the page element according to the tag type information of the page element, for example, determine that the tag type of page element a is the tag type, then obtain the tag attribute information "Kai Ti, No. 2 font" corresponding to the title type; render the content information of page element a according to the tag attribute information.

[0135] It should be noted that obtaining the tag attribute information when rendering the page element can be obtaining the tag attribute information in the tag data list, or obtaining the preset tag attribute information, that is, creating tag default style information for different tag types and reading configurations, wherein the tag default style information can be the initialization font size, font color, character spacing, line spacing, paragraph spacing, line break indent spacing and other style values, for example,< / h1> <h1>、< / h1> <h2>、< / h2> <h3>、< / h3> <h4>、< / h4> <h5>、< / h5> <h6>As the title label, the font size is from large to small (the corresponding font size values ​​are 18, 17, 16, 15, 14, 13), and the font color is black; As a text label, the font size is 14 and the font color is black; 做为注解标签,做为超链接标签,字号为12,字体颜色为蓝色等。

[0136] 本申请提供文件处理方法,接收文件展示指令,并基于所述文件展示指令获取待展示文件,其中,所述待展示文件为第二格式;解析所述待展示文件获得标签列表;根据所述标签列表和所述第一格式创建标签数据列表,其中,所述标签数据列表中包含标签内容信息以及标签属性信息;基于所述标签属性信息在所述文件阅读器中展示所述标签内容信息。本申请的文件处理方法,通过在已有的文件阅读器中增加对第二格式文件的解析方法,使第二格式的文件也可以在文件阅读器中展示,增加了文件阅读器的兼容性,提升了用户的阅读体验。

[0137] 下述结合附图2,以本申请提供的文件处理方法在漫画阅读器的应用为例,对所述文件处理方法进行进一步说明。其中,图2示出了本申请一实施例提供的一种应用于漫画阅读器的文件处理方法的处理流程图,具体包括以下步骤:

[0138] 步骤202:接收开启指令,开启漫画阅读器。

[0139] 具体的,用户通过触发漫画阅读器,生成开启指令;基于开启指令开启漫画阅读器。

[0140] 步骤204:接收文件展示指令,并基于文件展示指令确定epub格式的轻小说文件,对轻小说文件进行解析获得标签列表。

[0141] 具体的,确定文件展示指令中的文件标识,基于文件标识确定epub格式的轻小说文件;对轻小说文件进行解压缩,获得该文件中的HTML内容;通过对HTML内容进行解析,确定标签的树形标签结构,并将其转换为平面形的标签结构,将转换为平面形的标签结构的标签依次存储,获得标签列表。

[0142] 步骤206:基于标签列表创建标签数据列表。

[0143] 具体的,根据标签列表以及文件阅读器可识别的第一格式创建标签数据列表;第一格式中包含第一子格式以及第二子格式;确定标签列表中标签的标签分类类型,并基于标签分类类型确定标签对应的第一子格式或第二子格式;基于第一子格式创建第一标签分段数据,并基于第二子格式创建标签分段元素,由标签分段元素构成第二标签分段数据;将第一标签分段数据以及第二标签分段数据进行存储得到标签数据列表。

[0144] 步骤208:根据漫画阅读器的显示设置对标签数据列表中的标签分段数据进行排版,获得页数据列表。

[0145] 具体的,获取漫画阅读器的显示设置,确定显示区域宽高等信息;获取标签数据列表中标签分段数据的标签属性信息,即文本的字号等信息;基于标签属性信息计算标签内容的宽高信息;通过标签分段元素在显示区域展示的坐标信息,判断显示区域中可展示的标签分段元素生成页元素,并由页元素组成页数据;遍历完成标签数据列表中的所有标签分段数据,并创建对应的页数据后,由页数据组成页数据列表。

[0146] 步骤210:基于标签属性信息对页数据列表中的所属标签内容信息进行渲染并展示。

[0147] 具体的,确定页数据列表中的目标页数据;获取目标页数据的数据类型为标题类型,则确定标题类型对应的预设元素样式信息为"黑体,5号字”,则根据预设元素样式信息为"黑体,5号字”对目标页数据的所属内容信息进行渲染并展示。

[0148] 本申请提供的文件处理方法,接收文件展示指令,并基于所述文件展示指令获取待展示文件,其中,所述待展示文件为第二格式;解析所述待展示文件获得标签列表;根据所述标签列表和所述第一格式创建标签数据列表,其中,所述标签数据列表中包含标签内容信息以及标签属性信息;基于所述标签属性信息在所述文件阅读器中展示所述标签内容信息。本申请一实施例实现了通过在已有的文件阅读器中增加对第二格式文件的解析方法,使第二格式的文件也可以在文件阅读器中展示,增加了文件阅读器的兼容性,提升了用户的阅读体验。

[0149] 下述结合附图3,以本申请提供的文件处理方法在文件阅读器A的应用为例,对创建页数据列表的方法进行进一步说明。其中,图3示出了本申请一实施例提供的一种创建页数据列表的处理流程图,具体包括以下步骤:

[0150] 步骤302:创建标签默认样式信息。

[0151] 步骤304:获取文件阅读器A所在终端的屏幕宽高,计算显示区域。

[0152] 步骤306:创建页数据。

[0153] 步骤308:创建空的页数据列表。

[0154] 步骤310:遍历标签数据列表,并判断页数据列表中是否包含页元素;若是,则执行步骤314;若否,则执行步骤312。

[0155] 步骤312:将创建的页数据添加至页数据列表。

[0156] 步骤314:确定页数据列表中的最后一个页元素。

[0157] 步骤316:基于确定的最后一个页元素计算起始坐标。

[0158] 步骤318:遍历标签数据列表中,标签分段数据中的标签分段元素。

[0159] 步骤320:获取标签分段元素的标签类型信息。

[0160] 步骤322:基于标签类型信息,判断标签类型是否为正文类型;若是,则执行步骤324,若否,则执行步骤348。

[0161] 步骤324:遍历正文内容。

[0162] 具体的,在标签分段数据中获取正文长度信息,基于正文长度信息遍历标签分段数据中的正文内容。

[0163] 步骤326:获取当前类型样式。

[0164] 具体的,获取正文类型对应的标签样式信息。

[0165] 步骤328:测量当前字符的宽高。

[0166] 具体的,基于正文内容的字号、显示样式等信息计算字符的宽度以及高度信息。

[0167] 步骤330:判断起始坐标加元素当前高度是否超过行宽度;若是,则执行步骤332,若否,则执行步骤336。

[0168] 步骤332:换页,并创建新的页数据加入页数据列表。

[0169] 步骤334:重置该页的排版起始坐标。

[0170] 步骤336:判断起始坐标加元素宽度是否超过行宽度;若是,则执行步骤338,若否,则执行步骤340。

[0171] 步骤338:换行,加行间距,计算元素新起始坐标。

[0172] 步骤340:根据元素宽高计算元素结束坐标。

[0173] 步骤342:创建页元素,记录并传入元素类型、坐标。

[0174] 步骤344:将页元素加入页元素列表。

[0175] 步骤346:将上一元素的坐标作为新起始坐标。

[0176] 步骤348:遍历完成获得页元素列表、页数据列表。

[0177] 步骤350:判断标签类型是否为标题类型;若是,则执行步骤324,若否,则执行步骤352。

[0178] 步骤352:判断标签类型是否注释、超连接类型;若是,则执行步骤324,若否,则执行步骤354。

[0179] 步骤354:判断标签类型是否图片类型;若是,则执行步骤356,若否,则执行步骤372。

[0180] 步骤356:获取图片类型样式(宽高等)。

[0181] 步骤358:判断图片宽高是否超过排版区域;若是,则执行步骤360,若否,则执行步骤362。

[0182] 步骤360:缩放至宽度小于排版区域宽度,获取新宽高。

[0183] 步骤362:换行,加行间距,居中对齐,计算元素新起始坐标。

[0184] 步骤364:判断起始坐标加元素高度是否超过当前页高度;若是,则执行步骤366,若否,则执行步骤370。

[0185] 步骤366:换页,创建新的单页数据,加入页数据列表。

[0186] 步骤368:重置该页的排版起始坐标。

[0187] 步骤370:根据元素宽高计算元素结束坐标。

[0188] 步骤372:判断标签类型是否为其他类型。

[0189] 本申请通过判断在显示区域中可以对哪些元素进行展示,从而将页元素存储至对应的页数据中,在当前显示区域不能再容纳新的页元素时,再在页数据列表中创建新的页数据,从而实现基于页数据在显示区域中分页展示文件内容,丰富了文件展示形式,提升了用户阅读体验。

[0190] 下述结合附图4,以本申请提供的文件处理方法在文件阅读器B的应用为例,对渲染标签内容信息的方法进行进一步说明。其中,图4示出了本申请一实施例提供的一种渲染标签内容信息的处理流程图,具体包括以下步骤::

[0191] 步骤402:创建小说卡片。

[0192] 具体的,基于文件阅读器B的屏幕中的显示区域中可完整展示的页数据,组成多个小说卡片。

[0193] 步骤404:在页数据列表中获取对应的页码数据。

[0194] 步骤406:遍历页数据。

[0195] 步骤408:获取当前元素的标签类型信息。

[0196] 步骤410:判断当前元素的元素类型是否为正文类型;若是,则执行步骤412,若否,则执行步骤414。

[0197] 步骤412:获取当前类型样式。

[0198] 具体的,获得当前元素的当前类型样式。

[0199] 步骤414:判断当前元素的元素类型是否为标题类型;若是,则执行步骤412,若否,则执行步骤418。

[0200] 步骤416:绘制渲染当前元素。

[0201] 具体的,对小说卡片中的页数据进行渲染;渲染后的小说卡片可以嵌入文件阅读器B中进行展示。

[0202] 步骤418:判断当前元素的元素类型是否为注释、超连接类型;若是,则执行步骤412,若否,则执行步骤420。

[0203] 步骤420:判断当前元素的元素类型是否为图片类型;若是,则执行步骤412,若否,则执行步骤422。

[0204] 步骤422:判断当前元素的元素类型是否为其他类型。

[0205] 通过基于页元素的元素类型确定对应的元素样式信息,实现了基于页元素类型对应的元素样式信息对页元素进行渲染,从而丰富了对页元素即对文件内容的展示形式,进而提升了用户的阅读体验。

[0206] 与上述方法实施例相对应,本申请还提供了文件处理装置实施例,图5示出了本申请一实施例提供的一种文件处理装置的结构示意图。如图5所示,该装置包括:

[0207] 接收模块502,被配置为接收文件展示指令,并基于所述文件展示指令获取待展示文件,其中,所述待展示文件为第二格式;

[0208] 解析模块504,被配置为解析所述待展示文件获得标签列表;

[0209] 创建模块506,被配置为根据所述标签列表和所述第一格式创建标签数据列表,其中,所述标签数据列表中包含标签内容信息以及标签属性信息;

[0210] 展示模块508,被配置为基于所述标签属性信息在所述文件阅读器中展示所述标签内容信息。

[0211] 可选地,所述解析模块504,进一步被配置为:

[0212] 解析所述待展示文件获得标签集合;

[0213] 在所述标签集合中的标签为第一标签结构的情况下,将所述第一标签结构的标签转换为第二标签结构的标签,并基于所述第二标签结构的标签生成标签列表。

[0214] 可选地,所述解析模块504,进一步被配置为:

[0215] 确定所述标签集合中的目标标签;

[0216] 基于预设遍历规则,以所述目标标签作为起始标签遍历所述标签集合中的标签,获得第二标签结构的标签。

[0217] 可选地,所述创建模块506,进一步被配置为:

[0218] 确定所述标签列表中每个标签的标签分类类型,其中,所述标签分类类型包括非文本标签类型以及文本标签类型;

[0219] 在所述标签列表中的标签为所述非文本标签类型的情况下,基于第一子格式和所述标签列表创建第一标签分段数据;

[0220] 在所述标签列表中的标签为所述文本标签类型的情况下,基于第二子格式和所述标签列表创建第二标签分段数据;

[0221] 基于所述第一标签分段数据和所述第二标签分段数据生成所述标签数据列表。

[0222] 可选地,所述创建模块506,进一步被配置为:

[0223] 确定所述标签的标签内容信息、标签类型信息以及标签属性信息;

[0224] 基于所述第一子格式对所述标签内容信息、标签类型信息以及标签属性信息进行存储,获得第一标签分段数据。

[0225] 可选地,所述创建模块506,进一步被配置为:

[0226] 确定所述标签的父标签,并确定所述父标签对应的子标签;

[0227] 获取所述每个子标签的标签内容信息、标签类型信息以及标签属性信息;

[0228] 基于所述每个子标签的标签内容信息、标签属性信息所述父标签的标签类型信息以及所述第二子格式组成每个标签对应的标签分段元素;

[0229] 根据每个标签分段元素组成所述父标签对应的第二标签分段数据。

[0230] 可选地,所述展示模块508,进一步被配置为:

[0231] 获取所述文件阅读器的显示设置信息;

[0232] 基于所述显示设置信息和所述标签属性信息在所述文件阅读器中展示所述标签内容信息。

[0233] 可选地,所述展示模块508,进一步被配置为:

[0234] 基于所述显示设置信息、所述标签属性信息创建页数据列表;

[0235] 根据所述页数据列表对所述标签内容信息进行展示。

[0236] 可选地,所述展示模块508,进一步被配置为:

[0237] 确定预设页数据列表;

[0238] 判断所述预设页数据列表中是否包含页元素,并获得判断结果;

[0239] 基于所述判断结果以及所述显示设置信息遍历所述标签数据列表,获得至少一个页数据,其中,所述页数据中包含页元素;

[0240] 根据所述至少一个页数据和所述预设页数据列表生成页数据列表。

[0241] 可选地,所述展示模块508,进一步被配置为:

[0242] 在所述判断结果为是的情况下,确定所述预设页数据列表中的目标页元素,并将所述目标页元素的坐标信息作为起始坐标信息;

[0243] 基于所述起始坐标信息以及所述显示设置信息遍历所述标签数据列表。

[0244] 可选地,所述展示模块508,进一步被配置为:

[0245] 在所述判断结果为否的情况下,确定所述预设页数据列表中的预设元素坐标,并将所述预设元素坐标作为起始坐标信息;

[0246] 基于所述起始坐标信息以及所述显示设置信息遍历所述标签数据列表。

[0247] 可选地,所述展示模块508,进一步被配置为:

[0248] 确定所述标签数据列表中的标签分段数据的标签类型信息,并基于所述标签类型信息和所述起始坐标信息确定索引信息、坐标信息、所属标签类型信息和所属标签内容信息;

[0249] 基于所述索引信息、坐标信息、所属标签类型信息和所属标签内容信息创建页元素;

[0250] 根据所述显示设置信息和所述标签分段数据的标签属性信息确定起始索引信息以及结束索引信息,并基于所述页元素、所述起始索引信息以及所述结束索引信息创建页数据。

[0251] 可选地,所述展示模块508,进一步被配置为:

[0252] 基于所述页数据列表对所述标签内容信息进行渲染。

[0253] 本申请的文件处理装置包括,接收模块,被配置为接收文件展示指令,并基于所述文件展示指令获取待展示文件,其中,所述待展示文件为第二格式;解析模块,被配置为解析所述待展示文件获得标签列表;创建模块,被配置为根据所述标签列表和所述第一格式创建标签数据列表,其中,所述标签数据列表中包含标签内容信息以及标签属性信息;展示模块,被配置为基于所述标签属性信息在所述文件阅读器中展示所述标签内容信息。通过在已有的文件阅读器中增加对第二格式文件的解析功能,使第二格式的文件也可以在文件阅读器中展示,增加了文件阅读器的兼容性,提升了用户的阅读体验。

[0254] 上述为本实施例的一种文件处理装置的示意性方案。需要说明的是,该文件处理装置的技术方案与上述的文件处理方法的技术方案属于同一构思,文件处理装置的技术方案未详细描述的细节内容,均可以参见上述文件处理方法的技术方案的描述。

[0255] 图6示出了根据本申请一实施例提供的一种计算设备600的结构框图。该计算设备600的部件包括但不限于存储器610和处理器620。处理器620与存储器610通过总线630相连接,数据库650用于保存数据。

[0256] 计算设备600还包括接入设备640,接入设备640使得计算设备600能够经由一个或多个网络660通信。这些网络的示例包括公用交换电话网(PSTN)、局域网(LAN)、广域网(WAN)、个域网(PAN)或诸如因特网的通信网络的组合。接入设备640可以包括有线或无线的任何类型的网络接口(例如,网络接口卡(NIC))中的一个或多个,诸如IEEE802.11无线局域网(WLAN)无线接口、全球微波互联接入(Wi-MAX)接口、以太网接口、通用串行总线(USB)接口、蜂窝网络接口、蓝牙接口、近场通信(NFC)接口,等等。

[0257] 在本申请的一个实施例中,计算设备600的上述部件以及图6中未示出的其他部件也可以彼此相连接,例如通过总线。应当理解,图6所示的计算设备结构框图仅仅是出于示例的目的,而不是对本申请范围的限制。本领域技术人员可以根据需要,增添或替换其他部件。

[0258] 计算设备600可以是任何类型的静止或移动计算设备,包括移动计算机或移动计算设备(例如,平板计算机、个人数字助理、膝上型计算机、笔记本计算机、上网本等)、移动电话(例如,智能手机)、可佩戴的计算设备(例如,智能手表、智能眼镜等)或其他类型的移动设备,或者诸如台式计算机或PC的静止计算设备。计算设备600还可以是移动式或静止式的服务器。

[0259] 其中,处理器620执行所述计算机指令时实现所述的文件处理方法的步骤。

[0260] 上述为本实施例的一种计算设备的示意性方案。需要说明的是,该计算设备的技术方案与上述的文件处理方法的技术方案属于同一构思,计算设备的技术方案未详细描述的细节内容,均可以参见上述文件处理方法的技术方案的描述。

[0261] 本申请一实施例还提供一种计算机可读存储介质,其存储有计算机指令,该计算机指令被处理器执行时实现如前所述文件处理方法的步骤。

[0262] 上述为本实施例的一种计算机可读存储介质的示意性方案。需要说明的是,该存储介质的技术方案与上述的文件处理方法的技术方案属于同一构思,存储介质的技术方案未详细描述的细节内容,均可以参见上述文件处理方法的技术方案的描述。

[0263] 上述对本申请特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。

[0264] 所述计算机指令包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。

[0265] 需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。

[0266] 在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。

[0267] 以上公开的本申请优选实施例只是用于帮助阐述本申请。可选实施例并没有详尽叙述所有的细节,也不限制该发明仅为所述的具体实施方式。显然,根据本申请的内容,可作很多的修改和变化。本申请选取并具体描述这些实施例,是为了更好地解释本申请的原理和实际应用,从而使所属技术领域技术人员能很好地理解和利用本申请。本申请仅受权利要求书及其全部范围和等效物的限制。 < / h6> < / h1> < / h1> < / h1> < / h1> < / h1> < / em> < / h2> < / em> < / h1> < / h1>

Claims

1. A file processing method, It is characterized in that Applied to a file reader, the file reader is used to display a file in a first format, including: receiving a file display instruction, and acquiring a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format; Parsing the file to be displayed to obtain a tag list; Creating a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information; Displaying the tag content information in the file reader based on the tag attribute information; The step of creating a label data list according to the label list and the first format includes: Determine a tag classification type of each tag in the tag list, wherein the tag classification type includes a non-text tag type and a text tag type; In a case where the tag in the tag list is of the non-text tag type, creating first tag segment data based on the first sub-format and the tag list; When the tag in the tag list is of the text tag type, creating second tag segment data based on a second sub-format and the tag list; generating the label data list based on the first label segment data and the second label segment data; Among them, the non-text tag type refers to a tag type that does not have a parent tag or meets the format conversion requirements and can be directly converted to a second format; the text tag type refers to a tag type that has a parent tag and has multiple text content tags under the parent tag.

2. The file processing method according to claim 1, It is characterized in that Parsing the file to be displayed to obtain a tag list includes: Parsing the file to be displayed to obtain a tag set; In a case where the tags in the tag set are of a first tag structure, the tags of the first tag structure are converted into tags of a second tag structure, and a tag list is generated based on the tags of the second tag structure.

3. The file processing method according to claim 2, It is characterized in that Converting the tag of the first tag structure into a tag of the second tag structure includes: Determine a target tag in the tag set; Based on a preset traversal rule, the tags in the tag set are traversed with the target tag as a starting tag to obtain tags of a second tag structure.

4. The file processing method according to claim 1, It is characterized in that In a case where the tag in the tag list is of the non-text tag type, creating first tag segment data based on the first sub-format and the tag list includes: Determining label content information, label type information, and label attribute information of the label; The tag content information, tag type information, and tag attribute information are stored based on the first sub-format to obtain first tag segment data.

5. The file processing method according to claim 1, It is characterized in that In a case where the tags in the tag list are of the text tag type, creating second tag segment data based on the second sub-format and the tag list includes: Determine the parent tag of the tag, and determine the child tag corresponding to the parent tag; Obtaining tag content information, tag type information, and tag attribute information of each sub-tag; Based on the tag content information of each sub-tag, the tag attribute information, the tag type information of the parent tag and the second sub-format, a tag segmentation element corresponding to each tag is formed; The second tag segment data corresponding to the parent tag is formed according to each tag segment element.

6. The file processing method according to claim 1, It is characterized in that Displaying the tag content information in the file reader based on the tag attribute information includes: Obtaining display setting information of the file reader; The tag content information is presented in the document reader based on the display setting information and the tag attribute information.

7. The file processing method according to claim 6, It is characterized in that Displaying the tag content information in the file reader based on the display setting information and the tag attribute information includes: Creating a page data list based on the display setting information and the tag attribute information; The tag content information is displayed according to the page data list.

8. The file processing method according to claim 7, It is characterized in that Creating a page data list based on the display setting information and the tag attribute information includes: Determine the preset page data list; Determine whether the preset page data list contains a page element, and obtain a determination result; Based on the judgment result and the display setting information, the tag data list is traversed to obtain at least one page data, wherein the page data includes page elements; A page data list is generated according to the at least one page data and the preset page data list.

9. The file processing method according to claim 8, It is characterized in that Traversing the label data list based on the judgment result and the display setting information includes: If the judgment result is yes, determining a target page element in the preset page data list, and using the coordinate information of the target page element as the starting coordinate information; The tag data list is traversed based on the starting coordinate information and the display setting information.

10. The file processing method according to claim 8, It is characterized in that Traversing the label data list based on the judgment result and the display setting information includes: If the judgment result is no, determining the preset element coordinates in the preset page data list, and using the preset element coordinates as the starting coordinate information; The tag data list is traversed based on the starting coordinate information and the display setting information.

11. The file processing method according to claim 9 or 10, It is characterized in that Traversing the label data list based on the determination result and the display setting information to obtain at least one page data includes: Determine the tag type information of the tag segment data in the tag data list, and determine the index information, coordinate information, the tag type information and the tag content information based on the tag type information and the starting coordinate information; Creating a page element based on the index information, coordinate information, tag type information, and tag content information; The start index information and the end index information are determined according to the display setting information and the tag attribute information of the tag segment data, and the page data is created based on the page element, the start index information and the end index information.

12. The file processing method according to claim 7, It is characterized in that Before displaying the tag content information in the file reader based on the tag attribute information, the method further includes: The tag content information is rendered based on the page data list.

13. A file processing device, It is characterized in that Applied to a file reader, the file reader is used to display a file in a first format, including: a receiving module, configured to receive a file display instruction, and obtain a file to be displayed based on the file display instruction, wherein the file to be displayed is in a second format; A parsing module, configured to parse the to-be-displayed file to obtain a tag list; A creation module, configured to create a tag data list according to the tag list and the first format, wherein the tag data list includes tag content information and tag attribute information; A display module, configured to display the tag content information in the file reader based on the tag attribute information; The step of creating a label data list according to the label list and the first format includes: Determine a tag classification type of each tag in the tag list, wherein the tag classification type includes a non-text tag type and a text tag type; In a case where the tag in the tag list is of the non-text tag type, creating first tag segment data based on the first sub-format and the tag list; When the tag in the tag list is of the text tag type, creating second tag segment data based on a second sub-format and the tag list; generating the label data list based on the first label segment data and the second label segment data; Among them, the non-text tag type refers to a tag type that does not have a parent tag or meets the format conversion requirements and can be directly converted to a second format; the text tag type refers to a tag type that has a parent tag and has multiple text content tags under the parent tag.

14. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer instructions, the steps of the method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium storing computer instructions. It is characterized in that When the computer instructions are executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.

16. A computer program product comprising computer instructions, It is characterized in that When the computer instructions are executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Electronic book loading and displaying method, electronic equipment and storage medium

    CN111460345A

  • EPUB file analysis method

    CN112632959A