Rich text data processing method and device, equipment, storage medium and program product

CN123013850APending Publication Date: 2026-10-30CHENGDOU HUAQIYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611297118.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种富文本数据处理方法、装置、设备、存储介质及程序产品,旨在解决相关技术中富文本数据处理复杂度高的技术问题

Benefits of technology

本申请通过将富文本HTML文档拆分为纯文本片段、媒体片段和嵌套富组件片段,并利用相互隔离的第一私用区和第二私用区对媒体片段及嵌套富组件片段进行原子化占位,将复杂的HTML结构转换为可进行统一差异计算的扁平化片段序列,在避免原生字符与占位符冲突的同时,借助通用差异算法确定各片段的操作类型,并通过映射关系恢复媒体片段和嵌套富组件片段的原始结构,进一步结合媒体类型、资源地址及嵌套富组件唯一标识进行变更行为判定,并对同一嵌套富组件进行内部递归差异计算,从而能够在保留原有富文本结构和组件完整性的基础上,实现对文本、媒体及复杂富组件的精准增删改识别,降低复杂HTML直接比对造成的结构错乱和语义误判,提高富文本版本差异比对的准确性、完整性及可读性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013850A_ABST
    Figure CN123013850A_ABST
Patent Text Reader

Abstract

The application discloses a rich text data processing method and device, equipment, a storage medium and a program product, relates to the technical field of data processing, and the method comprises the steps that two rich text HTML documents to be compared are acquired and respectively split, pure text segments, media segments and nested rich component segments of the rich text HTML documents are obtained; each media segment is distributed with a first private area placeholder according to the order of appearance in the rich text HTML document, each nested rich component segment is distributed with a second private area placeholder according to the order of appearance in the rich text HTML document; the first private area placeholder, the second private area placeholder and the pure text segments are sequentially spliced according to the original arrangement order to obtain two flattened segment sequences to be compared; the operation types of the segments are determined, the behavior of the pure text segments, the media segments and the nested rich component segments is judged, and the change of the rich text HTML document is determined. The application reduces the complexity of rich text data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to rich text data processing methods, apparatus, devices, storage media, and program products. Background Technology

[0002] In a content management system (CMS) scenario, editors often create multiple historical versions of the same text and image manuscript after making multiple revisions and savings. Reviewers need to compare the current version with historical versions to accurately identify additions, deletions, and changes to the main text, images, audio and video, and embedded rich text components. These rich text manuscripts generally feature complex HyperText Markup Language (HTML) structures, rich inline styles, and interleaved arrangement of media elements and text.

[0003] How to perform high-precision, semantic offline difference comparison between two independently stored rich text HTML historical snapshots while preserving the complete layout structure has become a key issue in media convergence content review, version tracing, and manuscript review. Summary of the Invention

[0004] The main objective of this application is to provide a rich text data processing method, apparatus, device, storage medium, and program product, aiming to solve the technical problem of high complexity in rich text data processing in related technologies.

[0005] Firstly, to achieve the above objectives, this application provides a rich text data processing method, the method comprising: Obtain and split the two rich text HTML documents to be compared separately to obtain plain text fragments, media fragments, and nested rich component fragments of the rich text HTML documents; Construct a first private area and a second private area, for each rich text HTML document to be compared. Each media segment is assigned a placeholder in the first private area according to the order in which it appears in the rich text HTML document. Each nested rich component segment is assigned a placeholder in the second private area according to the order in which it appears in the rich text HTML document. During the assignment process, the rich text HTML document to which each placeholder belongs is recorded. The first private area placeholder, the second private area placeholder, and the plain text fragment are concatenated in the original order of the corresponding rich text HTML documents to obtain two flattened fragment sequences to be compared. Perform difference calculations on two flattened segment sequences to determine the operation type for each segment; Based on the operation type, behavior determination is performed on plain text fragments, media fragments, and nested rich component fragments to determine the changes in rich text HTML documents.

[0006] In one embodiment, for each rich text HTML document to be compared, the steps of assigning first private area placeholders to each media segment according to the order in which they appear in the rich text HTML document, and assigning second private area placeholders to each nested rich component segment according to the order in which they appear in the rich text HTML document, include: Based on the order in which each media segment appears in the rich text HTML document, placeholders for the first private area are assigned to each media segment sequentially, starting from the beginning of the first private area, and a first mapping relationship is established between the first private area placeholders and the corresponding media segments. Based on the order in which each nested rich component fragment appears in the rich text HTML document, placeholders for the second private area are sequentially assigned to each nested rich component fragment starting from the starting interval of the second private area, thus establishing a second mapping relationship between the second private area placeholders and the corresponding nested rich component fragments.

[0007] In one embodiment, before the step of sequentially concatenating the first private area placeholder, the second private area placeholder, and the plain text fragment in their original order to obtain two flattened fragment sequences to be compared, the method further includes the following step: Before the step of concatenating the first private area placeholder, the second private area placeholder, and the plain text fragment in their original order to obtain the two flattened character sequences to be compared, the following step is also included: Identify native characters in plain text fragments that conflict with the first private zone placeholder and the second private zone placeholder; Replace native characters with preset object replacement characters.

[0008] In one embodiment, the step of determining changes to a rich text HTML document by performing behavior determination on plain text fragments, media fragments, and nested rich component fragments based on operation type includes: Based on the first mapping relationship, the first private area placeholder in the flattened segment sequence is reverse mapped to determine the operation type of the media segment corresponding to the first private area placeholder; Based on the second mapping relationship, the second private area placeholder in the flattened fragment sequence is reverse mapped to determine the operation type of the nested rich component fragment corresponding to the second private area placeholder; Behavior determination is performed on plain text fragments, media fragments, and nested rich component fragments to identify changes to rich text HTML documents.

[0009] In one embodiment, the step of determining changes to a rich text HTML document by performing behavior determination on plain text fragments, media fragments, and nested rich component fragments includes: If the operation type of the first media segment and the second media segment at the same alignment position in two rich text HTML documents remains unchanged, then determine the media type of the first media segment and the second media segment. If the media type is different, the change is determined to be a replacement; If the media types are different, compare the resource addresses of the first media segment and the resource addresses of the second media segment; If they are different, then the change is determined to be a replacement.

[0010] In one embodiment, the step of determining changes to a rich text HTML document by performing behavior determination on plain text fragments, media fragments, and nested rich component fragments includes: If the operation types of the first nested rich component fragment and the second nested rich component fragment at the same alignment position in two rich text HTML documents are unchanged, then determine the unique identifier of the first nested rich component fragment and the second nested rich component fragment. If the unique identifiers are different, the change is determined to be a replacement; If the unique identifiers are the same, a recursive difference calculation is performed on the internal DOM structure of the first nested rich component fragment and the internal DOM structure of the second nested rich component to determine the content changes.

[0011] Secondly, to achieve the above objectives, this application further provides a rich text data processing apparatus, the apparatus comprising: The acquisition module is used to acquire and split the two rich text HTML documents to be compared, and obtain the plain text fragments, media fragments and nested rich component fragments of the rich text HTML documents. The allocation module constructs a first private area and a second private area, for each rich text HTML document to be compared. Each media segment is assigned a placeholder in the first private area according to the order in which it appears in the rich text HTML document. Each nested rich component segment is assigned a placeholder in the second private area according to the order in which it appears in the rich text HTML document. During the assignment process, the rich text HTML document to which each placeholder belongs is recorded. The splicing module is used to sequentially splice the first private area placeholder, the second private area placeholder, and the plain text fragment according to the original arrangement order of the corresponding rich text HTML document to obtain two flattened fragment sequences to be compared. The difference calculation module is used to perform difference calculations on two flattened segment sequences and determine the operation type for each segment; The situation determination module is used to determine the behavior of plain text fragments, media fragments, and nested rich component fragments based on the operation type, and to determine the changes in rich text HTML documents.

[0012] Thirdly, to achieve the above objectives, this application further provides a rich text data processing apparatus, the apparatus comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the rich text data processing method described above.

[0013] Fourthly, to achieve the above objectives, this application further provides a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the rich text data processing method described above.

[0014] Fifthly, to achieve the above objectives, this application further provides a computer program product, which includes a computer program and, when the computer program is executed by a processor, the steps of a rich text data processing method implemented thereon.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: This application splits rich text HTML documents into plain text fragments, media fragments, and nested rich component fragments. It then uses isolated first and second private regions to atomically place media fragments and nested rich component fragments, transforming the complex HTML structure into a flattened fragment sequence capable of unified difference calculation. This avoids conflicts between native characters and placeholders, while using a general difference algorithm to determine the operation type of each fragment. The original structure of media fragments and nested rich component fragments is restored through mapping relationships. Furthermore, it combines media type, resource address, and unique identifier of nested rich components to determine change behavior and performs internal recursive difference calculations on the same nested rich component. This allows for accurate identification of additions, deletions, and modifications to text, media, and complex rich components while preserving the original rich text structure and component integrity. It reduces structural confusion and semantic misjudgments caused by direct comparison of complex HTML, improving the accuracy, completeness, and readability of rich text version difference comparison. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the rich text data processing method in the embodiments of this application.

[0019] Figure 2 This is a schematic diagram of the module connections for a rich text data processing device.

[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0023] The main solution of this application embodiment is as follows: Two rich text HTML documents to be compared are acquired and split separately to obtain plain text fragments, media fragments, and nested rich component fragments; a first private area and a second private area are constructed, each with its own isolated space, and corresponding placeholders are assigned to the media fragments and nested rich component fragments, establishing a mapping relationship between the placeholders and the original fragments; the plain text fragments and placeholders are sequentially concatenated according to their original arrangement in the rich text HTML documents to obtain a flattened fragment sequence, and the difference calculation is performed on the flattened fragment sequence to determine the operation type of each fragment; further, the placeholders are reverse-mapped based on the mapping relationship to restore the corresponding media fragments and nested rich component fragments, and the behavior of the plain text fragments, media fragments, and nested rich component fragments is determined according to the operation type, media type, resource address, and unique identifier of the nested rich component; when the unique identifier corresponding to the nested rich component has not changed, a recursive difference calculation is performed on its internal DOM structure to determine the specific changes in the two rich text HTML documents.

[0024] Specifically, traditional full-text character difference algorithms based on HTML strings are highly sensitive to element positions. Inserting an image into a paragraph changes the character offsets of the entire subsequent text, easily leading to large areas of meaningless difference annotations and invalid comparisons where "minor image changes result in the entire text being highlighted in red," severely interfering with review and judgment. However, plain text stripping results in the loss of layout structure, completely eliminating core information such as WeChat layout styles, third-party editor components, inline formatting, and image / text layout structure. This makes it impossible to accurately reproduce the manuscript's true presentation, allowing only simple text comparison and rendering it unsuitable for formal review scenarios in multimedia platforms.

[0025] Furthermore, current integrated media articles contain numerous embedded and nested rich components such as the 135 editor and WeChat layout tools. The HTML code for these components is often lengthy and hierarchically complex. In the context of reviewing articles in an integrated media CMS, a single article may contain dozens of images, multiple audio and video files, and numerous nested rich components. Editors cannot simultaneously resolve the four core issues of media misalignment, structural loss, semantic missingness, and component fragmentation in mixed text and image layout scenarios using the methods described above. Therefore, a high-precision, highly adaptable, and semantically accurate integrated version comparison technology solution is urgently needed to adapt to the mixed text and image layout scenarios of integrated media.

[0026] Based on this, embodiments of this application provide a rich text data processing method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the rich text data processing method of this application. The inventive concept of this embodiment is to perform "atomicing + flattening" on the rich text HTML structure, which is originally difficult to directly compare uniformly. Specifically, media and nested rich components are converted into isolated private placeholders, forming a linear sequence of segments together with plain text. A general difference algorithm is then used to determine the change location and operation type of each segment. Based on this, the original media and rich components are restored through placeholder mapping, and semantics such as "addition, deletion, replacement" and "changes in component content" are further determined by combining media type, resource address, and component unique identifier. This achieves semantic change recognition from character-level difference recognition to rich text object-level semantic change recognition.

[0027] In this embodiment, the rich text data processing method includes steps S10 to S50: Step S10: Obtain and split the two rich text HTML documents to be compared to obtain plain text fragments, media fragments and nested rich component fragments of the rich text HTML documents.

[0028] For example, the entire DOM subtree is traversed using a depth-first search algorithm, and document nodes are categorized and split into plain text fragments, media fragments, and nested rich component fragments. Text nodes retain their original content and layout order, while media elements (images, videos, audio) and nested rich components are treated as independent atomic units, without disassembling their internal structure, thus ensuring element integrity.

[0029] Then, output an ordered sequence of fragments (text fragments, media fragments, and nested rich component fragments) in the original document arrangement order.

[0030] Step S20: Construct a first private area and a second private area. For each rich text HTML document to be compared, allocate placeholders for the first private area from the beginning of the first private area according to the order in which each media segment appears in the rich text HTML document. Allocate placeholders for the second private area from the beginning of the second private area according to the order in which each nested rich component segment appears in the rich text HTML document. During the allocation process, record the rich text HTML document to which each placeholder belongs.

[0031] In one feasible implementation, step S20 includes steps A10 to A20: Step A10: Based on the order in which each media segment appears in the rich text HTML document, assign placeholders for each media segment sequentially, starting from the beginning of the first private area, and establish the first mapping relationship between the first private area placeholders and the corresponding media segments.

[0032] Step A20: Based on the order in which each nested rich component fragment appears in the rich text HTML document, assign second private area placeholders to each nested rich component fragment starting from the starting interval of the second private area, and establish a second mapping relationship between the second private area placeholders and the corresponding nested rich component fragments.

[0033] For example, for the first rich text HTML document to be compared, a first private area (Unicode Private Use Area, PUA) and a second private area are constructed. Starting from the starting code point of the first private area, each media segment is replaced with a placeholder in the first private area code point range according to the position order of the media segments in the corresponding rich text HTML document. Simultaneously, a first mapping table mediaList is constructed, so that mediaList[idx] corresponds one-to-one with the first private area placeholder (e.g., 0xE000+idx), thus establishing the first mapping relationship.

[0034] Starting from the initial code point of the second private zone, according to the position order of the nested rich component fragments in the corresponding rich text HTML document, each nested rich component fragment is replaced with a second private zone placeholder within the code point interval of the second private zone. Simultaneously, a second mapping table, `richTagTokenMap`, is constructed to record the one-to-one correspondence between the second private zone placeholders and the nested rich component fragments `outerHTML`, thus establishing the second mapping relationship.

[0035] For example, for another rich text HTML document to be compared, the same first private area (Unicode Private Use Area, PUA) and second private area are constructed. Starting from the starting code point of the first private area, according to the position order of the media segments in the corresponding rich text HTML document, each media segment is replaced with a first private area placeholder within the code point range of the first private area. Simultaneously, a first mapping table mediaList is constructed, so that mediaList[idx] corresponds one-to-one with the first private area placeholder (e.g., 0xE000+idx), thus establishing the first mapping relationship.

[0036] Starting from the initial code point of the second private zone, according to the position order of the nested rich component fragments in the corresponding rich text HTML document, each nested rich component fragment is replaced with a second private zone placeholder within the code point interval of the second private zone. Simultaneously, a second mapping table, `richTagTokenMap`, is constructed to record the one-to-one correspondence between the second private zone placeholders and the nested rich component fragments `outerHTML`, thus establishing the second mapping relationship.

[0037] That is, the starting code points of the first private area placeholders in the two rich text HTML documents are the same, and the starting code points of the second private area placeholders in the two rich text HTML documents are the same.

[0038] Step S30: The first private area placeholder, the second private area placeholder, and the plain text fragment are sequentially concatenated according to the original arrangement order of the corresponding rich text HTML document to obtain two flattened fragment sequences to be compared.

[0039] For example, the sequence “Introduction + Image a.jpg + Text + Video v.mp4” will be converted into a flat sequence: Introduction + E000 + Text + E001, while mediaList[0] stores the image segment and mediaList[1] stores the video segment.

[0040] Furthermore, in a feasible implementation, steps B10 to B20 are preferably included before step S30: Step B10: Identify native characters in the plain text fragment that conflict with the first private area placeholder and the second private area placeholder.

[0041] Step B20: Replace the native character with a preset object replacement character.

[0042] Specifically, native characters refer to characters that are inherently present in the original content of a rich text HTML document. For example, if the first private zone uses a code point range starting with E000, and the original plain text fragment contains the character E000, this character might be mistakenly identified as a placeholder in the first private zone of the corresponding media fragment during subsequent processing. Similarly, if the plain text fragment contains characters within the code point range used by the second private zone, it might also be mistakenly identified as a placeholder in the second private zone of a nested rich component fragment. Therefore, by identifying the native characters that conflict with the placeholders, the target characters that need to be conflict-handled are determined. The native characters identified in the previous step are uniformly replaced with preset object replacement characters, such as the U+FFFC object replacement character in Unicode. After the replacement, the native characters no longer occupy code points in the first and second private zones, thus enabling the characters in the first private zone to uniquely represent media fragments, and the characters in the second private zone to uniquely represent nested rich component fragments. Therefore, when forming a flattened fragment sequence and performing subsequent difference calculations, ambiguity between native characters and the first private area placeholder and the second private area placeholder can be avoided, ensuring that the corresponding media fragments and nested rich component fragments can be accurately recovered when the placeholders are reverse mapped.

[0043] Step S40: Perform difference calculation on the two flattened segment sequences to determine the operation type of each segment.

[0044] Step S50: Based on the operation type, perform behavior determination on plain text fragments, media fragments, and nested rich component fragments to determine the changes in the rich text HTML document.

[0045] In one feasible implementation, the operation type may include addition, deletion, and no change, and step S50 includes steps C10 to C30: Step C10: Based on the first mapping relationship, perform inverse mapping processing on the first private area placeholder in the flattened segment sequence to determine the operation type of the media segment corresponding to the first private area placeholder.

[0046] Step C20: Based on the second mapping relationship, perform inverse mapping on the second private area placeholder in the flattened fragment sequence to determine the operation type of the nested rich component fragment corresponding to the second private area placeholder.

[0047] Step C30 involves performing behavior determination on plain text fragments, media fragments, and nested rich component fragments to identify changes to the rich text HTML document.

[0048] Step C30 includes steps C31 to C37: Step C31: If the operation types of the first media segment and the second media segment at the same alignment position in the two rich text HTML documents remain unchanged, then determine the media type of the first media segment and the second media segment.

[0049] Step C32: If the media type is different, then determine the change as a replacement.

[0050] Step C33: If the media types are the same, compare the resource addresses of the first media segment and the second media segment.

[0051] Step C34: If they are not the same, then the change is determined to be a replacement.

[0052] Step C35: If the operation types of the first nested rich component fragment and the second nested rich component fragment at the same alignment position in the two rich text HTML documents are unchanged, then determine the unique identifier of the first nested rich component fragment and the second nested rich component fragment. Step C36: If the unique identifiers are different, then the change is determined to be a replacement; Step C37: If the unique identifiers are the same, recursively calculate the differences between the internal DOM structure of the first nested rich component fragment and the internal DOM structure of the second nested rich component to determine the content changes.

[0053] Specifically, in step C10, for the first private area placeholder obtained from the difference calculation, the first mapping relationship established in step S20 is used for inverse mapping to restore the first private area placeholder to its corresponding media segment. The operation type of the corresponding media segment is then determined by combining the operation type of the first private area placeholder in the difference calculation result. For example, if the first private area placeholder corresponds to a deletion operation, the corresponding media segment is determined to be deleted; if it corresponds to an addition operation, the corresponding media segment is determined to be added; if it corresponds to an unchanged operation, it indicates that both rich text HTML documents have corresponding media segments at this alignment position, and further media change determination is required.

[0054] Step C20 is similar to step C10. For the second private area placeholder in the difference calculation result, the second mapping relationship is used to perform inverse mapping to restore the second private area placeholder to the corresponding nested rich component fragment. The nested rich component fragment is determined to be added, deleted or unchanged based on the operation type.

[0055] Step C30 further determines the behavior of the plain text fragments, media fragments, and nested rich component fragments after the inverse mapping process. Specifically, for fragments whose operation type is add or delete, the corresponding addition or deletion change can be directly determined; for fragments whose operation type is unchanged and which exist in the same alignment position in two rich text HTML documents, it is further determined whether the fragment itself has been replaced or its internal content has been changed.

[0056] For media segments, first determine if the operation types of the first and second media segments at the same alignment position in the two rich text HTML documents remain unchanged. If they do, it means that the character-level difference calculation considers the first private area placeholder at that position to have not changed. However, since the first private area placeholder only indicates the position and type of the media segment, and does not directly indicate the specific content of the media segment itself, it is also necessary to obtain the media type of the first and second media segments. For example, the media type can include images, videos, and audio.

[0057] If the media types of the first and second media segments are different, it means that although both versions have media segments at the corresponding positions, the specific types of the media segments have changed. For example, the old version is an image and the new version is a video. Therefore, it can be determined that media replacement has occurred at that position.

[0058] If two media segments have the same media type, the resource addresses of the first and second media segments are further compared. For example, for images, videos, or audio, the corresponding src addresses can be compared. If the two resource addresses are different, it means that although the two versions have the same type of media in the same location, the actual resources referenced have changed, thus confirming that the media segment has been replaced; if the resource addresses are the same, it can be determined that the media segments corresponding to the two versions have not undergone actual content changes.

[0059] For nested rich component fragments, first determine if the operation types of the first and second nested rich component fragments at the same alignment position in the two rich text HTML documents are identical. If they are identical, then further obtain the unique identifiers of the two nested rich component fragments to determine whether the two nested rich component fragments belong to the same component.

[0060] If the unique identifiers of the first nested rich component fragment and the second nested rich component fragment are different, it means that although both versions have nested rich components at the corresponding positions, they do not actually correspond to the same component. Therefore, it is determined that a nested rich component replacement has occurred at that position.

[0061] If two nested rich component fragments have the same unique identifier, it means that the two versions correspond to the same nested rich component. In this case, instead of directly determining it as a replacement, we further obtain the DOM structure inside the two nested rich component fragments and recursively calculate the differences between the two internal DOM structures to further determine what content changes have occurred in the text, media, or other child nodes inside the component.

[0062] Furthermore, for segments whose operation type is add or delete, the order and corresponding position of the segments in the difference results can be used to identify consecutively occurring delete and add segments through regular expression matching. When the delete and add segments correspond to media segments or nested rich component segments in the old and new versions, respectively, and they are in corresponding positions, the delete and add segments are associated and merged, and the changes corresponding to the delete and add segments are converted from independent delete and add behaviors into replacement behaviors. For example, it can be determined that the original media in the first rich text HTML document is replaced by the new media in the second rich text HTML document. Furthermore, for content added compared to the first rich text HTML document, the content characteristics of the media segments, nested rich component segments, or plain text segments corresponding to the added content can be matched with the corresponding content in the first rich text HTML document to determine whether the added content can establish an object correspondence with the existing content in the first rich text HTML document. If a correspondence can be established, the position changes of the existing content in the two rich text HTML documents are further considered to determine whether the added content is a position change of the original content, rather than actual added content, thereby reducing misjudgments caused by the movement of media segments or nested rich component segments.

[0063] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the rich text data processing method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0064] This application also provides a rich text data processing apparatus, please refer to... Figure 2 The rich text data processing device includes: The acquisition module 10 is used to acquire and split the two rich text HTML documents to be compared, and obtain the plain text fragments, media fragments and nested rich component fragments of the rich text HTML documents.

[0065] The allocation module 20 is used to construct a first private area and a second private area. For each rich text HTML document to be compared, the media segments are allocated first private area placeholders from the beginning of the first private area according to the order in which they appear in the rich text HTML document. The nested rich component segments are allocated second private area placeholders from the beginning of the second private area according to the order in which they appear in the rich text HTML document. During the allocation process, the rich text HTML document to which each placeholder belongs is recorded.

[0066] The splicing module 30 is used to sequentially splice the first private area placeholder, the second private area placeholder, and the plain text fragment according to the original arrangement order of the corresponding rich text HTML document to obtain two flattened fragment sequences to be compared.

[0067] The difference calculation module 40 is used to perform difference calculations on two flattened segment sequences to determine the operation type of each segment.

[0068] The situation determination module 50 is used to determine the behavior of plain text fragments, media fragments, and nested rich component fragments based on the operation type, and to determine the changes in the rich text HTML document.

[0069] The rich text data processing apparatus provided in this application, employing the rich text data processing method in the above embodiments, can solve the technical problems of related technologies. Compared with related technologies, the beneficial effects of the rich text data processing apparatus provided in this application are the same as those of the rich text data processing method provided in the above embodiments, and other technical features in the rich text data processing apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0070] This application provides a rich text data processing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the rich text data processing method in the above embodiments.

[0071] The rich text data processing device provided in this application, employing the rich text data processing method in the above embodiments, can solve the technical problems of related technologies. Compared with related technologies, the beneficial effects of the rich text data processing device provided in this application are the same as the beneficial effects of the rich text data processing method provided in the above embodiments, and other technical features in this rich text data processing device are the same as the features disclosed in the method of the previous embodiment, and will not be repeated here.

[0072] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0073] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0074] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the rich text data processing method in the above embodiments.

[0075] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described rich text data processing method, and is capable of solving the technical problems of related technologies. Compared with related technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the rich text data processing method provided in the above embodiments, and will not be repeated here.

[0076] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the rich text data processing method described above.

[0077] The computer program product provided in this application can solve the technical problems of related technologies. Compared with related technologies, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the rich text data processing method provided in the above embodiments, and will not be repeated here.

[0078] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A rich text data processing method, characterized in that, The method includes: Obtain and split the two rich text HTML documents to be compared separately to obtain plain text fragments, media fragments and nested rich component fragments of the rich text HTML documents; Construct a first private area and a second private area, for each rich text HTML document to be compared. Each media segment is assigned a placeholder in the first private area according to the order in which it appears in the rich text HTML document. Each nested rich component segment is assigned a placeholder in the second private area according to the order in which it appears in the rich text HTML document. During the assignment process, the rich text HTML document to which each placeholder belongs is recorded. The first private area placeholder, the second private area placeholder, and the plain text fragment are sequentially concatenated according to the original arrangement order of the corresponding rich text HTML document to obtain two flattened fragment sequences to be compared. The difference between the two flattened segment sequences is calculated to determine the operation type of each segment; Based on the operation type, behavior determination is performed on plain text fragments, media fragments, and nested rich component fragments to determine the changes to the rich text HTML document.

2. The rich text data processing method as described in claim 1, characterized in that, The steps of assigning first private area placeholders to each media segment according to the order in which they appear in the rich text HTML document, and assigning second private area placeholders to each nested rich component segment according to the order in which they appear in the rich text HTML document, for each rich text HTML document to be compared, include: Based on the order in which each media segment appears in the rich text HTML document, placeholders for the first private area are assigned to each media segment sequentially, starting from the beginning of the first private area, and a first mapping relationship is established between the first private area placeholders and the corresponding media segments. Based on the order in which each nested rich component fragment appears in the rich text HTML document, a second private area placeholder is sequentially assigned to each nested rich component fragment, starting from the beginning of the second private area, and a second mapping relationship is established between the second private area placeholder and the corresponding nested rich component fragment.

3. The rich text data processing method as described in claim 1, characterized in that, Before the step of sequentially concatenating the first private area placeholder, the second private area placeholder, and the plain text fragment in their original order to obtain two flattened fragment sequences to be compared, the method further includes the following step: Identify native characters in the plain text segment that conflict with the first private area placeholder and the second private area placeholder; Replace the native character with a preset object replacement character.

4. The rich text data processing method as described in claim 2, characterized in that, The step of determining the changes to the rich text HTML document based on the operation type includes: Based on the first mapping relationship, the first private area placeholder in the flattened segment sequence is reverse mapped to determine the operation type of the media segment corresponding to the first private area placeholder. Based on the second mapping relationship, the second private area placeholder in the flattened fragment sequence is reverse mapped to determine the operation type of the nested rich component fragment corresponding to the second private area placeholder; Behavior determination is performed on plain text fragments, media fragments, and nested rich component fragments to identify changes to rich text HTML documents.

5. The rich text data processing method as described in claim 4, characterized in that, The steps for determining the behavior of plain text fragments, media fragments, and nested rich component fragments to identify changes in the rich text HTML document include: If the operation type of the first media segment and the second media segment at the same alignment position in two rich text HTML documents remains unchanged, then the media type of the first media segment and the second media segment is determined. If the media types are different, the change is determined to be a replacement; If the media types are the same, then compare the resource address of the first media segment with the resource address of the second media segment; If they are different, then the change is determined to be a replacement.

6. The rich text data processing method as described in claim 4, characterized in that, The steps for determining the behavior of plain text fragments, media fragments, and nested rich component fragments to identify changes in the rich text HTML document include: If the operation types of the first nested rich component fragment and the second nested rich component fragment at the same alignment position in two rich text HTML documents are unchanged, then determine the unique identifiers of the first nested rich component fragment and the second nested rich component fragment; If the unique identifiers are different, the change is determined to be a replacement; If the unique identifiers are the same, then a recursive difference calculation is performed on the internal DOM structure of the first nested rich component fragment and the internal DOM structure of the second nested rich component to determine the content change.

7. A rich text data processing device, characterized in that, The device includes: The acquisition module is used to acquire and split the two rich text HTML documents to be compared, and obtain the plain text fragments, media fragments and nested rich component fragments of the rich text HTML documents. The allocation module is used to construct the first and second private zones for each rich text HTML document to be compared. Each media segment is assigned a placeholder in the first private area according to the order in which it appears in the rich text HTML document. Each nested rich component segment is assigned a placeholder in the second private area according to the order in which it appears in the rich text HTML document. During the assignment process, the rich text HTML document to which each placeholder belongs is recorded. The splicing module is used to sequentially splice the first private area placeholder, the second private area placeholder, and the plain text fragment according to the original arrangement order of the corresponding rich text HTML document to obtain two flattened fragment sequences to be compared. The difference calculation module is used to perform difference calculation on the two flattened segment sequences to determine the operation type of each segment; The situation determination module is used to determine the behavior of plain text fragments, media fragments, and nested rich component fragments based on the operation type, and to determine the changes in the rich text HTML document.

8. A rich text data processing device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the rich text data processing method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the rich text data processing method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the rich text data processing method as described in any one of claims 1 to 6.