Document processing method, apparatus, device, storage medium, and program product

By finding and updating the relative paths of nodes in the document's tree structure, the problem of low processing efficiency and accuracy when the document page structure changes in the prior art is solved, and fast and efficient document processing is achieved.

CN122113848APending Publication Date: 2026-05-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2024-11-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When the page structure of a document changes, existing technologies process the changes based on a tree structure that has removed data nodes, resulting in low accuracy and efficiency in the processing and an inability to quickly update the tree structure to reflect the changes in the page structure.

Method used

By identifying the nodes that cause changes in the page structure, the document's tree structure is obtained, and the relative paths of the nodes in the tree structure are found. The relative paths in the tree structure are updated based on the changed page structure, including finding the connection nodes above and below the node's level, and then updating them quickly.

Benefits of technology

It improves the accuracy and efficiency of document processing, avoids a complete traversal of the original document's tree structure, and enables rapid updates of the tree structure to reflect changes in the page structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122113848A_ABST
    Figure CN122113848A_ABST
Patent Text Reader

Abstract

The application provides a document processing method and device, electronic equipment, computer readable storage medium and computer program product, comprising: in response to the page structure of a document comprising multiple pages changing, determining a first node causing the page structure to change, the first node comprising at least one of a page node corresponding to a page and a data node corresponding to data in the page; obtaining a tree structure of the document, the tree structure being constructed based on the page node and the data node; finding a relative path of the first node in the tree structure of the document, the relative path being a path of a page node to which the first node belongs pointing to the first node; and updating the relative path in the tree structure of the document based on the changed page structure. Through the application, the efficiency and accuracy of processing the document can be improved when the page structure of the document changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a document processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology

[0002] In a document containing both data nodes and page nodes, page nodes may be subordinate to data nodes. Furthermore, any change to any data node in the document can alter the page structure. However, when maintaining the page structure, document processing is often based on a tree structure that excludes data nodes and includes only page nodes. This results in lower accuracy when the document's page structure changes. Additionally, when the page structure changes, the tree structure needs to be updated based on the changed structure. This updated tree structure is then used to determine the directory hierarchy for displaying multiple pages. However, a tree structure that only retains page nodes cannot be quickly updated from the original document; instead, the entire original document's tree structure must be traversed before updating. This leads to low processing efficiency when the document's page structure changes. Summary of the Invention

[0003] This application provides a document processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the efficiency and accuracy of document processing when the page structure of a document changes.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] This application provides a document processing method, including:

[0006] In response to a change in the page structure of a document comprising multiple pages, a first node causing the change in the page structure is determined, the first node including at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page;

[0007] Obtain the tree structure of the document, which is constructed based on the page nodes and the data nodes;

[0008] Find the relative path of the first node in the tree structure of the document, where the relative path is the path from the page node to which the first node belongs to the first node.

[0009] Based on the changed page structure, update the relative path in the document's tree structure.

[0010] This application provides a document processing apparatus, including:

[0011] A determination module is configured to, in response to a change in the page structure of a document comprising multiple pages, determine a first node that causes the change in the page structure, wherein the first node includes at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page;

[0012] The acquisition module is used to acquire the tree structure of the document, the tree structure being constructed based on the page nodes and the data nodes;

[0013] The search module is used to search for the relative path of the first node in the tree structure of the document, wherein the relative path is the path from the page node to which the first node belongs to the first node.

[0014] An update module is used to update the relative paths in the tree structure of the document based on the changed page structure.

[0015] In the above scheme, the device further includes a second search module, which is used to search for page nodes located above the level of the first node in the tree structure; determine page nodes that have a connection relationship with the first node among the found page nodes; and select the page node closest to the first node from the page nodes that have a connection relationship with the first node as the page node to which the first node belongs.

[0016] In the above scheme, the update module is further configured to determine the new page node to which the first node belongs based on the changed page structure, and determine the path from the new page node to the first node; and update the relative path of the first node to the path from the new page node to the first node.

[0017] In the above scheme, the update module is further configured to, when the reason for the change in the page structure is that a move operation against the first node is triggered in the document, obtain the parent node of the first node after the move; when the parent node is a page node, determine the parent node as the new page node to which the first node belongs; when the parent node is a data node, determine the page node to which the parent node belongs, and use the page node to which the parent node belongs as the new page node to which the first node belongs.

[0018] In the above scheme, the device further includes a third search module, which is used to search for a second node that has a connection relationship with the first node in the hierarchy below the first node; among the found second nodes, determine the target second node whose page node has changed; search for the relative path of the target second node in the tree structure of the document, and update the relative path of the target second node in the tree structure.

[0019] In the above scheme, the reason for the change in page structure is that a type conversion operation for the first node is triggered in the document. The third search module is also used to update the relative path of the target second node based on the path from the new page node to the target second node when the type conversion operation is used to convert the type of the first node from a page node to a data node; and to update the relative path of the target second node to the path from the first node to the target second node when the type conversion operation is used to convert the type of the first node from a data node to a page node.

[0020] In the above scheme, the third search module is further configured to update the relative path of the target second node to the path from the first node to the target second node when the first node is a page node; and to update the relative path of the target second node based on the path from the new page node to the target second node when the first node is a data node.

[0021] In the above scheme, the third search module is further configured to obtain the relative path of each second node in the tree structure; match the relative path of the first node with the relative path of each second node to obtain a matching result; and based on the matching result, determine the second node whose relative path intersects with the relative path of the first node as the target second node.

[0022] In the above scheme, the device further includes a first deletion module, which is used to determine the third node to be deleted in the document when the reason for the change in the page structure is that a node deletion operation is triggered in the document; to search for nodes located below the level of the third node in the tree structure; to select a fourth node that has a connection relationship with the third node from the nodes below the level of the third node; to search for the relative path of the third node and the relative path of the fourth node in the tree structure of the document, and to delete the third node, the fourth node, the relative path of the third node, and the relative path of the fourth node in the tree structure.

[0023] In the above scheme, the determining module is further configured to, in response to a change in the page structure of a document comprising multiple pages, parse the document comprising multiple pages to obtain multiple nodes included in the document; obtain operation information of the document editing operation that caused the change in the page structure; and, based on the operation information, select the first node that caused the change in the page structure from the multiple nodes.

[0024] In the above scheme, the acquisition module is further configured to parse the document including multiple pages to obtain multiple nodes included in the document; determine the connection relationship between the multiple nodes, and determine the root node of the tree structure corresponding to the document based on the connection relationship between the multiple nodes; construct an initial tree structure including the root node, and add the multiple nodes to the initial tree structure in sequence based on the connection relationship between the multiple nodes to obtain the tree structure of the document.

[0025] In the above scheme, the document includes a page management area, which is used to display and manage the connection relationship between the multiple pages; the device also includes a second deletion module, which is used to delete data nodes in the updated tree structure to obtain a target tree structure; based on the target tree structure, the connection relationship between the multiple pages in the page management area is updated.

[0026] This application provides an electronic device, including:

[0027] Memory is used to store executable instructions or computer programs.

[0028] The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the document processing method provided in the embodiments of this application.

[0029] This application provides a computer-readable storage medium storing computer-executable instructions or computer programs, which, when executed by a processor, implement the document processing method provided in this application.

[0030] This application provides a computer program product comprising computer-executable instructions or a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions or computer program from the computer-readable storage medium and executes the computer-executable instructions or computer program, causing the electronic device to perform the document processing method provided in this application.

[0031] The embodiments of this application have the following beneficial effects:

[0032] When the page structure of a document containing multiple pages changes, the nodes causing the change are identified. Then, the relative paths of these nodes are found within the tree structure built from the page nodes and data nodes. Based on the changed page structure, the relative paths in the document's tree structure are updated. This approach, processing the document based on a tree structure including both page and data nodes, improves accuracy compared to related technologies that process documents using only page nodes and excluding data nodes. Furthermore, it eliminates the need for a complete traversal of the original document's tree structure to update it; instead, it allows for rapid updates based on the relative paths of nodes, thus enhancing processing efficiency when the document's page structure changes. Attached Figure Description

[0033] Figure 1 This is a schematic diagram of the architecture of the document processing system 100 provided in an embodiment of this application;

[0034] Figure 2 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;

[0035] Figure 3 This is a flowchart illustrating the document processing method provided in an embodiment of this application;

[0036] Figure 4 This is a schematic diagram of a document including multiple pages provided in an embodiment of this application;

[0037] Figure 5 This is a schematic diagram of the page structure and tree structure of the document provided in the embodiments of this application;

[0038] Figure 6 This is a schematic diagram of page nodes and data nodes provided in the embodiments of this application;

[0039] Figure 7 This is a schematic diagram of the relative paths of nodes in the tree structure provided in the embodiments of this application;

[0040] Figure 8 This is a flowchart illustrating the relative path in the tree structure of the updated document provided in this application embodiment;

[0041] Figure 9 This is a schematic diagram of the process of moving the first node provided in an embodiment of this application;

[0042] Figure 10 This is a schematic diagram illustrating the process of changing the node type of the first node according to an embodiment of this application;

[0043] Figure 11This is a flowchart illustrating the process of updating the relative path of a second node that is connected to the first node, as provided in an embodiment of this application.

[0044] Figure 12 This is a schematic diagram of a second node that is connected to the first node, as provided in an embodiment of this application.

[0045] Figure 13 This is a schematic diagram illustrating the process of updating the relative path of the target second node based on type editing operations, as provided in an embodiment of this application.

[0046] Figure 14 This is a schematic diagram illustrating the process of updating the relative path of the target second node in the tree structure during a node-based movement operation provided in this application embodiment;

[0047] Figure 15 This is a schematic diagram of deleting the first node provided in an embodiment of this application;

[0048] Figure 16 This is a schematic diagram of the newly created first node provided in an embodiment of this application;

[0049] Figure 17 This is a schematic diagram of the page management area updated based on the target tree structure provided in an embodiment of this application;

[0050] Figure 18 This is a flowchart illustrating the document processing method provided in an embodiment of this application;

[0051] Figure 19 This application provides a display instruction based on a target page in a document;

[0052] Figure 20 This is a schematic diagram illustrating the deletion of a target node provided in an embodiment of this application;

[0053] Figure 21 This is a schematic diagram of a newly created target node provided in an embodiment of this application;

[0054] Figure 22 This is a schematic diagram of a moving target node provided in an embodiment of this application;

[0055] Figure 23 This is a schematic diagram illustrating the type of the conversion target node provided in an embodiment of this application;

[0056] Figure 24 This is a schematic diagram illustrating the process of opening a page as provided in an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0059] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0061] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0062] 1) In response to, used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.

[0063] 2) Client, also known as user terminal, refers to the program that provides local services to users in contrast to the server. Except for some applications that can only run locally, it is generally installed on the terminal and needs to work in conjunction with the server. That is, there needs to be a corresponding server and service program on the network to provide the corresponding services. Thus, a specific communication connection needs to be established between the client and the server to ensure the normal operation of the application, such as virtual scene clients (such as game clients) and video clients.

[0064] 3) Artificial Intelligence (AI) is the theory, methods, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0065] 4) Page Nodes: Page nodes are used to indicate container units that display text content. For example, a text page can be a page node. Page nodes can also be considered data nodes, carrying data. A page node can contain at least one data node.

[0066] 5) Data nodes are used to indicate the nodes in a document that carry content. For example, a line of text can be considered a data node. At least one data node is used to organize a readable piece of content. Page nodes can also include data nodes, and data nodes can also include page nodes.

[0067] 6) Page hierarchy refers to the hierarchical relationship between page nodes in a document with a corresponding tree structure.

[0068] 7) A relative path is the path from the page node of the page to which the node belongs to the node, including the multiple nodes that the path from the page node of the page to the node.

[0069] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the document processing system 100 provided in this application embodiment. The terminal (terminal 400 is shown as an example) is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using wireless or wired links.

[0070] The server 200 is configured to, in response to a change in the page structure of a document comprising multiple pages, determine the first node causing the change in page structure, wherein the first node includes at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page; obtain the tree structure of the document, the tree structure being constructed based on the page nodes and data nodes; find the relative path of the first node in the document's tree structure, wherein the relative path is the path from the page node to which the first node belongs to the first node; update the relative path in the document's tree structure based on the changed page structure; and send the updated tree structure to the terminal 400.

[0071] Terminal 400 is used to receive the updated tree structure and, based on the updated tree structure, display the changed page structure of the document.

[0072] In some embodiments, server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal 400 can be a smartphone, tablet, laptop, desktop computer, set-top box, smart voice interaction device, smart home appliance, virtual reality device, vehicle terminal, aircraft, portable music player, personal digital assistant, dedicated messaging device, portable gaming device, smart speaker, and smartwatch, but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.

[0073] The electronic device implementing the document processing method provided in the embodiments of this application will now be described. See also Figure 2 , Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device can be a server or a terminal. The electronic device is used as an example. Figure 1 Taking the server shown as an example, Figure 2 The illustrated electronic device includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 2 The general labeled all buses as Bus System 440.

[0074] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0075] User interface 430 includes one or more output devices 431 that enable the display of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0076] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.

[0077] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.

[0078] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0079] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;

[0080] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.

[0081] Presentation module 453 is configured to enable the display of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;

[0082] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.

[0083] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A document processing device 455 stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a determination module 4551, an acquisition module 4552, a search module 4553, and an update module 4554. These modules are logically linked and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.

[0084] In other embodiments, the apparatus provided in this application can be implemented in hardware. For example, the document processing apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the document processing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0085] In some embodiments, the terminal or server can implement the document processing method provided in this application by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), i.e., a local client, which is a program that needs to be installed in the operating system to run, such as an instant messaging APP or a web browser APP; it can also be a mini-program, i.e., a program that only needs to be downloaded into a browser environment to run; or it can be a mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of client, module, or plugin.

[0086] Based on the above description of the document processing system and electronic device provided in the embodiments of this application, the document processing method provided in the embodiments of this application is described below. In actual implementation, the document processing method provided in the embodiments of this application can be implemented by a terminal or a server alone, or by a terminal and a server working together, so that... Figure 1 The following description uses the example of server 200 executing the document processing method provided in this embodiment of the application independently as an example. See also... Figure 3 , Figure 3This is a flowchart illustrating the document processing method provided in this application embodiment. Next, it will be discussed in conjunction with... Figure 3 The steps shown are explained.

[0087] Step 101: In response to a change in the page structure of a document comprising multiple pages, the server determines the first node that caused the change in the page structure. The first node includes at least one of the following: the page node corresponding to the page and the data node corresponding to the data in the page.

[0088] In practice, before the server responds to a change in the page structure of a document containing multiple pages and determines the first node that caused the change, it first receives a page structure update request sent by the terminal. Based on the page structure update request, the server determines that the page structure of the document containing multiple pages has changed, and then responds to the change in the page structure of the document containing multiple pages and determines the first node that caused the change.

[0089] Specifically, the terminal responds to document display operations by displaying the document content and page structure; then it responds to document editing operations on the document content or page structure, and when the document editing operation causes changes to the page structure, it sends a page structure update request to the server.

[0090] It should be noted that the document here comprises multiple pages, and the page structure is formed based on these pages. Each page can include at least one subpage. Document editing operations can include adding, deleting, converting, moving, modifying, and deleting nodes. Operations that change the page structure are node-related; that is, only when the document editing operation is a node addition, deletion, conversion, or movement operation will the page structure change. For example, see [link to example document]. Figure 4 , Figure 4 This is a schematic diagram of a document including multiple pages provided in the embodiments of this application. The dashed box 401 indicates the multiple pages included in the document, and the dashed box 403 indicates the page content of the page indicated by the dashed box 402.

[0091] In practice, the process of determining the first node causing the page structure change in response to a change in the page structure of a document comprising multiple pages may involve parsing the document comprising multiple pages to obtain multiple nodes included in the document; obtaining operation information of the document editing operation that caused the page structure change; and selecting the first node causing the page structure change from the multiple nodes based on the operation information.

[0092] It should be noted that the document comprises multiple pages and has a corresponding page structure, which is equivalent to the document having a page hierarchy. Page hierarchy refers to the hierarchical relationship between page nodes in a tree-like document; for example, see... Figure 5 , Figure 5 This is a schematic diagram of the page structure and tree structure of the document provided in the embodiments of this application, based on Figure 5 , Figure 5 The dashed box 501 in section a indicates the document's page structure, while Figure 5 The 'b' indicates the document's tree structure, where the page structure corresponds to the tree structure. Figure 5 In the tree structure indicated by b, nodes A, D, F, I, J, and B are page nodes, while C, H, E, and G are data nodes.

[0093] Therefore, when the page structure of a document comprising multiple pages changes, during the parsing of the document to obtain the multiple nodes it contains, these multiple nodes refer to all nodes in the document's tree structure. These multiple nodes include data nodes and page nodes. Data nodes indicate the nodes within the document that carry content; for example, a line of text can be considered a data node. Page nodes indicate the container units that present the text content; for example, a text page can be a page node. Page nodes can also be considered data nodes, carrying data. A page node can include at least one data node, which is used to organize readable content. Simultaneously, page nodes can also include data nodes, and data nodes can also include page nodes. For example, see [link to example]. Figure 6 , Figure 6 This is a schematic diagram of page nodes and data nodes provided in the embodiments of this application, based on Figure 6 Nodes A, D, F, I, J, and B are page nodes, while C, H, E, and G are data nodes.

[0094] Then, after identifying multiple nodes in the document, the operation information of the document editing operation that caused the page structure change is obtained. This operation information is carried in the page structure update request sent by the terminal. When the server receives the page structure update request, it can obtain the operation information of the document editing operation that caused the page structure change by analyzing the request. Here, the operation information can also be the type of document editing operation and the specific operation content. For example, when the document editing operation is a node movement operation, the operation information can be the identifier of the moved node, the position of the corresponding node before being moved, and the position after being moved. Then, based on the operation information, the first node that caused the page structure change is selected from multiple nodes.

[0095] Step 102: Obtain the tree structure of the document, which is constructed based on page nodes and data nodes.

[0096] In practice, obtaining the tree structure of a document can be either obtaining a tree structure of a document built in real time or obtaining a tree structure of a document built in advance. This application does not limit the specific method. Taking obtaining the tree structure of a document built in real time as an example, the process of obtaining the tree structure of a document can be as follows: parse a document containing multiple pages to obtain multiple nodes included in the document; determine the connection relationship between multiple nodes, and determine the root node of the tree structure corresponding to the document based on the connection relationship between multiple nodes; construct an initial tree structure including the root node, and add multiple nodes to the initial tree structure in sequence based on the connection relationship between multiple nodes to obtain the tree structure of the document.

[0097] It should be noted that, as mentioned earlier, a document includes multiple nodes, including page nodes and data nodes. Data nodes are used to indicate the nodes that carry content in the document; for example, a line of text can be considered a data node. Page nodes are used to indicate the container units that present text content; for example, a text page can be a page node. Page nodes can also be considered data nodes and can carry data. A page node can include at least one data node, and at least one data node is used to organize a readable piece of content. At the same time, page nodes can also include data nodes, and data nodes can also include page nodes.

[0098] In practice, the process of adding multiple nodes sequentially to the initial tree structure based on the connections between them to obtain the document's tree structure involves determining the hierarchy between nodes based on their connections, and then adding nodes layer by layer to the initial tree structure to obtain the document's tree structure. For example, see [link to example]. Figure 5 ,based on Figure 5 , Figure 5 The tree structure indicated by 'b' is constructed based on the connection relationships between multiple nodes.

[0099] Step 103: Find the relative path of the first node in the document's tree structure. The relative path is the path from the page node to which the first node belongs to the first node.

[0100] In practice, each node in the tree structure has a relative path. This relative path is determined by the page node to which the node belongs; that is, the path from the page node to the corresponding node is the relative path of that node. For example, see [link to example]. Figure 7 , Figure 7 This is a schematic diagram of the relative paths of nodes in the tree structure provided in the embodiments of this application, based on Figure 7 , Figure 7 The 'a' indicates the tree structure of the document. Figure 7 The 'b' indicates the type of each node in the tree structure and the relative path of the corresponding node. Taking node C as an example, node C is a data node and the relative path of node C is AC.

[0101] In practice, before searching for the relative path of the first node in the document's tree structure, it is necessary to determine the page node to which the first node belongs. Specifically, before searching for the relative path of the first node in the document's tree structure, it is also possible to search for page nodes at the level above the first node in the tree structure; among the found page nodes, determine the page nodes that have a connection relationship with the first node; and from the page nodes that have a connection relationship with the first node, select the page node that is closest to the first node as the page node to which the first node belongs.

[0102] It should be noted that the connection relationships here include both direct and indirect connections. For example, if node A's child node is B, and node B's child node is C, then node A and node B have a direct connection, and node B and node C also have a direct connection. However, node A and node C have an indirect connection. See also [example example]. Figure 7 ,based on Figure 7 Taking node C as an example, nodes D, H, and A are directly connected to node C; nodes E, F, and G are indirectly connected to node C.

[0103] Then, after identifying the page nodes connected to the first node from the found page nodes, the page node closest to the first node is selected from these connected page nodes as the page node to which the first node belongs. For example, see [link to previous section]. Figure 7 ,based on Figure 7 Taking node F as an example, among the nodes at the same level as node F, node D has a direct connection with node F, and nodes A and C have an indirect connection with node F. Thus, nodes A, C, and D are connected to node F. Among nodes A, C, and D, the page nodes are nodes A and D. Among them, the page node closest to node F is node D, that is, node D is the page node to which node F belongs.

[0104] It should be noted that, specifically, the server stores the tree structure of the document. When the page structure of a document containing multiple pages changes, the obtained document tree structure is either the tree structure pre-stored before the page structure changes, or a tree structure built in real time based on the document whose page structure has not changed.

[0105] Step 104: Based on the changed page structure, update the relative paths in the document's tree structure.

[0106] In practice, for the process of updating the relative paths in the document's tree structure based on the changed page structure, see [link to documentation]. Figure 8 , Figure 8 This is a flowchart illustrating the relative path in the tree structure of the updated document provided in this application embodiment, based on... Figure 8 Step 104 can be achieved through the following steps.

[0107] Step 1041: Based on the changed page structure, determine the new page node to which the first node belongs, and determine the path from the new page node to the first node.

[0108] In practice, as mentioned above, there are various document editing operations that can cause changes in the page structure. The changes in the page structure also differ depending on the document editing operation. Therefore, the following section will explain the process of determining the new page node to which the first node belongs based on the changed page structure for different document editing operations.

[0109] In some embodiments, the document editing operation that causes a change in the page structure is a node movement operation. Specifically, when the page structure changes because a movement operation on the first node is triggered in the document, the parent node of the first node after the movement is obtained. When the parent node is a page node, the parent node is determined as the new page node to which the first node belongs. When the parent node is a data node, the page node to which the parent node belongs is determined, and the page node to which the parent node belongs is used as the new page node to which the first node belongs.

[0110] It should be noted that the move operation for the first node refers to moving the first node from one node to another, that is, the parent node of the first node changes. Therefore, when the new parent node of the first node is a page node, the new parent node is determined as the new page node to which the first node belongs; when the new parent node of the first node is a data node, the page node to which the new parent node belongs is determined and the page node to which the new parent node belongs is taken as the new page node to which the first node belongs.

[0111] For example, see Figure 9 , Figure 9 This is a schematic diagram of the process of moving the first node provided in an embodiment of this application, based on Figure 9 ,Will Figure 9 In node a, node C moves to node I, as follows: Figure 9 As shown in b; therefore, the first node is node C, and the parent node of the first node after the move is node I. Here, node I is a page node, so node I is determined as the new page node to which node C belongs.

[0112] In other embodiments, the document editing operation that causes the page structure to change is a node type conversion operation. Specifically, when the page structure changes because a type conversion operation for the first node is triggered in the document, the page node to which the first node belonged before the type conversion is taken as the new page node to which the first node belongs.

[0113] It should be noted that the type conversion operation for the first node is used to change the node type of the first node. As mentioned above, nodes include data nodes and page nodes. Therefore, when the first node is a page node, the type conversion operation for the first node is used to convert the first node from a page node to a data node. At this time, if there is still a data node between the first node and the page node to which it belonged before the type conversion, the first node's level will also be promoted to the same level as the existing data node during the type conversion, and the page node to which the first node belonged before the type conversion will be taken as the new page node to which the first node belongs. If there is no data node between the first node and the page node to which it belonged before the type conversion, the level of the first node will not be changed, and the page node to which the first node belonged before the type conversion will be taken as the new page node to which the first node belongs.

[0114] When the first node is a data node, the type conversion operation for the first node is used to convert the first node from a data node to a page node; at this time, the page node to which the first node belonged before the type conversion is directly taken as the new page node to which the first node belongs.

[0115] In this application, the node type of the first node changes, but the page node to which it belongs remains unchanged. When the page structure changes because a type conversion operation on the first node is triggered in the document, the page node to which the first node belonged before the type conversion is taken as the new page node to which the first node belongs. Furthermore, for data nodes, neither their child nodes nor their parent nodes can be data nodes; they can only be data nodes with indirect connections. For example, if two data nodes are parent and child nodes, but they are actually on the same page, they can be understood as belonging to the same page node. Therefore, the child nodes are directly... The corresponding data node is promoted to the same level as its parent node. Indirect connections will be explained later and will not be elaborated upon here. Therefore, when the first node is a page node, the type conversion operation for the first node is used to convert it from a page node to a data node. If there are still data nodes between the first node and the page node to which it belongs before the type conversion, the first node's level is promoted to the same level as the existing data nodes. Furthermore, since a data node's child nodes cannot be data nodes, and its parent node cannot be a data node either, there can only be data nodes with indirect connections. Therefore, there cannot be multiple data nodes.

[0116] For example, see Figure 10 , Figure 10 This is a schematic diagram illustrating the process of changing the node type of the first node according to an embodiment of this application, based on... Figure 10 Taking node C as the first node as an example, Figure 10 In node a, node C is transformed from a data node to... Figure 10 The page node indicated in b is node A, and before the type conversion, node C belongs to the page node A. Therefore, node A becomes the new page node to which node C belongs.

[0117] In some embodiments, the type of document editing operation can be disregarded, and the new page node to which the first node belongs can be determined directly according to the process of determining the page node to which the first node belongs. That is, the page node located above the level of the first node is searched in the tree structure; the page node with a connection relationship with the first node is determined among the found page nodes; and the page node closest to the first node is selected from the page nodes with a connection relationship with the first node as the page node to which the first node belongs.

[0118] It should be noted that the connection relationships here, as described above, include both direct and indirect connections. For example, if node A's child node is B, and node B's child node is C, then node A and node B have a direct connection, and node B and node C also have a direct connection. However, node A and node C have an indirect connection. The process of determining the new page node to which the first node belongs is similar to the process of determining the page node to which the first node belongs, as described above, and will not be elaborated upon in this embodiment.

[0119] Step 1042: Update the relative path of the first node to the path of the new page node pointing to the first node.

[0120] In practice, the path from the new page node to the first node is obtained, and this path is used as the relative path of the first node, thereby updating the relative path of the first node. For example, see [link to example]. Figure 9 and Figure 10 ,based on Figure 9 When the page structure changes because a move operation targeting the first node is triggered in the document, the relative path of node C is changed from... Figure 9 In node a, AC is updated to the path from node I to node C, i.e., IC; based on Figure 10 The page structure changes when a type conversion operation is triggered on the first node in the document, changing the relative path of node C from... Figure 10 In node a, if AC is updated to the path from node A to node C in the new page, then AC is still updated, meaning the relative path of node C remains unchanged.

[0121] In some embodiments, when the page structure changes, in addition to affecting the relative path of the first node, the relative paths of other nodes connected to the first node are also affected. Specifically, after updating the relative paths in the document's tree structure based on the changed page structure, see [link to documentation]. Figure 11 , Figure 11 This is a flowchart illustrating the process of updating the relative path of a second node that is connected to the first node, based on an embodiment of this application. Figure 11 The process of updating the relative paths of other nodes that are connected to the first node is achieved through the following steps.

[0122] Step 201: The server searches for a second node that has a connection relationship with the first node in the hierarchy below the first node.

[0123] It should be noted that, as mentioned above, the connection relationships here include both direct and indirect connections. For example, see [link to relevant documentation]. Figure 12 , Figure 12This is a schematic diagram of a second node that is connected to the first node, provided in an embodiment of this application. Figure 12 Node C is the first node, and the second nodes that are connected to node C are shown in the dashed box 1201, namely nodes D, H, E, F, and G.

[0124] Step 202: Among the found second nodes, determine the target second node whose page node has changed.

[0125] In practice, the process of determining the target second node whose page node has changed among the found second nodes can be as follows: obtain the relative path of each second node in the tree structure; match the relative path of the first node with the relative path of each second node to obtain the matching result; based on the matching result, determine the second node whose relative path intersects with the relative path of the first node as the target second node.

[0126] It should be noted that the target second node refers to the second node whose page node changes due to changes in the page structure. Regarding the process of determining whether a relative path intersects with the relative path of the first node, this intersection means the relative path passes through the first node. For example, if the relative path of the first node is ACD and the relative path of the second node is DE, then the relative path of the second node intersects with the relative path of the first node at point D, meaning the relative path passes through node D, and this second node is the target second node. Alternatively, if the relative path of the second node is ACDE, meaning the relative path passes through node D, then the relative path of the second node intersects with the relative path of the first node at point ACD, and this second node is the target second node. Or, if the relative path of the second node is EF, then the relative path of the second node does not intersect with the relative path of the first node.

[0127] For example, see [link to previous article] Figure 12 ,based on Figure 12 The relative path of node C is AC, the relative path of node D is ACD, the relative path of node H is ACH, the relative path of node E is DE, the relative path of node F is DF, and the relative path of node G is FG. Therefore, only the relative paths of nodes D and H intersect with the relative path of node C. Thus, nodes D and H are the target second nodes.

[0128] Step 203: Locate the relative path of the target second node in the document's tree structure and update the relative path of the target second node in the tree structure.

[0129] It should be noted that, as mentioned earlier, the relative path is determined based on the page node to which the node belongs; that is, the path from the page node to which the node belongs to the corresponding node is the relative path of that node. Therefore, the relative path of the target second node is the path from the page node to which the target second node belongs to the target second node.

[0130] In practice, the process of finding the relative path of the target second node in the document's tree structure is similar to the process of finding the relative path of the first node in the document's tree structure described earlier. Specifically, it involves finding page nodes at the same level as the target second node in the tree structure; identifying page nodes that are connected to the target second node from among the found page nodes; selecting the page node closest to the target second node from among the page nodes connected to it as the page node to which the target second node belongs; and updating the relative path of the target second node in the tree structure by obtaining the initial relative path of the target second node and updating it to the path pointed to by the selected page node to which the target second node belongs, which is also the updated relative path of the found target second node.

[0131] It should be noted that the tree structure here is the updated tree structure. In the updated tree structure, the relative path of the target second node has not been updated based on the changes in the page structure. Therefore, updating the relative path of the target second node in the tree structure means updating the target second node in the tree structure where the relative path of the first node has been updated but whose relative path has not yet been updated. That is, the initial relative path of the target second node here is the relative path of the target second node before updating the relative path in the document's tree structure based on the changed page structure, which is the relative path of the target second node in the unupdated tree structure. The process of obtaining the initial relative path of the target second node is similar to the process of finding the relative path of the first node in the document's tree structure mentioned above, and will not be described in detail here.

[0132] In practice, as mentioned above, the relative path of the target second node will change based on the changes in the page structure caused by the first node. Therefore, the relative path of the target second node may also be related to the first node. Specifically, the process of updating the relative path of the target second node in the tree structure can be as follows: when the first node is a page node, update the relative path of the target second node to the path from the first node to the target second node; when the first node is a data node, update the relative path of the target second node based on the path from the new page node to the target second node.

[0133] It should be noted that the new page node here refers to the new page node to which the first node mentioned earlier belongs; also, as mentioned earlier, document editing operations include node movement operations and node type conversion operations. Here, regardless of the type of document editing operation, the relative path of the first node to the target second node can be updated. Specifically, when the first node is a page node, the process of updating the relative path of the target second node to the path from the first node to the target second node can be as follows: In response to a change in the page structure caused by a movement operation on the first node in the document, the relative path of the target second node is updated to the path from the first node to the target second node; or in response to a change in the page structure caused by a type conversion operation on the first node in the document, the relative path of the target second node is updated to the path from the first node to the target second node.

[0134] When the first node is a data node, the process of updating the relative path of the target second node based on the path from the new page node to the target second node can be as follows: In response to a change in page structure caused by a move operation on the first node triggered in the document, the relative path of the target second node is updated to the path from the new page node to the target second node; In response to a change in page structure caused by a type conversion operation on the first node triggered in the document, if there are data nodes between the first node and its associated page node, and the target second node is a data node, a reference path from the new page node to the target second node is determined, and the first node in the reference path is deleted to obtain a standard path; the standard path is then used as the updated relative path of the target second node.

[0135] If there are data nodes between the first node and its page node, and the target second node is a page node, then a reference path from the new page node to the target second node is determined; the reference path is used as the relative path of the updated target second node.

[0136] If there is no data node between the first node and its page node, and the target second node is a data node, then a reference path from the new page node to the target second node is determined, and the first node in the reference path is deleted to obtain a standard path; the standard path is used as the relative path of the updated target second node.

[0137] If there is no data node between the first node and its page node, and the target second node is a page node, then a reference path from the new page node to the target second node is determined, and the reference path is used as the relative path of the updated target second node.

[0138] It should be noted that deleting the first node can be understood as elevating the target second node to the same level as the first node. As mentioned earlier, in this application, for data nodes, their child nodes cannot be data nodes, and their parent nodes cannot be data nodes either; they can only be data nodes with indirect connections. For example, if two data nodes are parent and child nodes, but are actually on the same page, they can be understood as belonging to the same page node. Therefore, the level of the data node corresponding to the child node is directly elevated to the same level as the parent node. Based on this, if there are still data nodes between the first node and its page node, and the target second node is a data node, or if there are still data nodes between the first node and its page node, and the target second node is a page node, the level of the first node has already been elevated in the relative path of updating the first node, which is equivalent to deleting the existing data nodes. Therefore, the reference path from the new page node to the target second node does not include the existing data nodes.

[0139] Additionally, if the change in page structure is due to a type conversion operation triggered on the first node in the document, then "when the first node is a data node or a page node" here refers to the case where the first node after type conversion is a data node or a page node.

[0140] Next, we will explain the process of updating the relative path of the target second node in the tree structure based on the first node, using two different types of document editing operations.

[0141] In some embodiments, the page structure changes because a type conversion operation is triggered in the document for the first node, thereby updating the relative path of the target second node in the tree structure. This process can be as follows: when the type conversion operation is used to convert the type of the first node from a page node to a data node, the relative path of the target second node is updated based on the path from the new page node to the target second node; when the type conversion operation is used to convert the type of the first node from a data node to a page node, the relative path of the target second node is updated to the path from the first node to the target second node.

[0142] It should be noted that since the relative path of the target second node is determined based on the first node, when the type conversion operation is used to convert the type of the first node from a page node to a data node, the relative path of the target second node is updated to the path from the new page node to the target second node. Here, the new page node is the new page node to which the first node belongs, as mentioned above. As for the process of updating the relative path of the target second node based on the path from the new page node to the target second node, as mentioned above, in this application, for a data node, its child nodes cannot be data nodes, and its parent nodes cannot be data nodes either. There can only be data nodes with indirect connection relationships. Therefore, when the type conversion operation is used to convert the type of the first node from a page node to a data node, the process of updating the relative path of the target second node based on the path from the new page node to the target second node is similar to the process described above when the first node is a data node, and the relative path of the target second node is updated based on the path from the new page node to the target second node. The reason for the change in the page structure is that a type conversion operation for the first node is triggered in the document. It will not be elaborated here.

[0143] When a type conversion operation is used to convert the type of the first node from a data node to a page node, the relative path of the target second node is updated to the path from the first node to the target second node; for example, see Figure 13 , Figure 13 This is a schematic diagram illustrating the process of updating the relative path of the target second node based on type editing operations, as provided in an embodiment of this application. Figure 13 Taking node C as the first node as an example, Figure 13 In node a, node C is transformed from a data node to... Figure 13 The page node indicated in b, Figure 13 The dashed box 1301 in b indicates the second node of node C. Nodes D and H are the target second nodes. Thus, the relative path ACD of the target second node, i.e., node D, is updated to the path CD from node C to node D, and the relative path ACH of node H is updated to the path CH from node C to node H.

[0144] In other embodiments, the page structure changes because a move operation on the first node is triggered in the document, thereby updating the relative path of the target second node in the tree structure. This process can be as follows: when the first node is a page node, the relative path of the target second node is updated to the path from the first node to the target second node; when the first node is a data node, the relative path of the target second node is updated to the path from the new page node to the target second node.

[0145] It should be noted that when the first node is a page node, the relative path of the target second node remains unchanged; the node movement operation does not change the page node to which the target second node belongs. However, when the first node is a data node, the page node to which the target second node belongs will change following the node movement operation. For example, it may change from the page node to which the first node belongs to a new page node, where the new page node is the one described above. See, for an example... Figure 14 , Figure 14 This is a schematic diagram illustrating the process of updating the relative path of the target second node in the tree structure during a node-based movement operation provided in this application embodiment. Figure 14 ,Will Figure 14 In node a, node C moves to node I, as follows: Figure 14 As shown in b; thus the first node is node C, and the dashed box 1401 indicates the second node of node C, where node D and node H are the target second node, thus the relative path ACD of the target second node, i.e. node D, is updated to the path ICD of the new page node, i.e. node I pointing to node D, and the relative path ACH of node H is updated to the path ICH of the new page node, i.e. node I pointing to node H.

[0146] In practice, updating the tree structure is not based on updating the existing relative paths within the tree structure. Instead, it involves creating or deleting relative paths. For example, when the document editing operation is a node deletion operation, updating the tree structure can involve deleting a node and updating the relative paths of the corresponding nodes. Conversely, when the document editing operation is a node creation operation, updating the structure can involve creating a new tree structure and updating the relative paths of the corresponding nodes. The following sections will explain the process of updating the tree structure based on different types of document editing operations.

[0147] In some embodiments, the process of updating the relative paths in the document's tree structure based on the changed page structure can be as follows: when the page structure changes because a node deletion operation is triggered in the document, the first node and its relative path are deleted from the tree structure.

[0148] As mentioned earlier, when the page structure changes, it affects not only the relative path of the first node but also the relative paths of other nodes connected to it. Therefore, deleting the first node also deletes other nodes connected to it. Specifically, after deleting the first node and its relative path in the tree structure, the nodes below the level of the first node are searched in the tree structure. From these nodes, the fifth node connected to the first node is selected. The relative path of the fifth node is then searched in the document's tree structure, and the deleted fifth node and its relative path are also retrieved.

[0149] It should be noted that the process of selecting the fifth node from the nodes below the first node's level that are connected to the first node involves several steps. First, based on the relative paths of the nodes, nodes whose relative paths pass through the first node are selected from the nodes below the first node's level. Then, for the page nodes among these selected nodes, based on the relative paths of the nodes, nodes whose relative paths pass through these page nodes are selected from the nodes below the page nodes' levels. This process continues until the last level of the tree structure, and these selected nodes are then designated as the fifth node. Here, "relative path passing through the first node" means that the relative path includes the first node, i.e., the relative path intersects with the relative path of the first node. The process of determining whether the relative path intersects with the relative path of the first node is as described above and will not be repeated here.

[0150] Thus, compared to the method in related technologies that requires traversing layer by layer to select the fifth node that is connected to the first node from the nodes below the first node's level, selecting the fifth node that is connected to the first node from the nodes below the first node's level based on the relative path reduces the computational cost and improves the selection efficiency of the fifth node.

[0151] It should be noted that the connection relationships here include both direct and indirect connections. After deleting the first node, all nodes below the first node that are connected to the first node are also deleted, i.e., the fifth node. For example, see... Figure 15 , Figure 15 This is a schematic diagram of deleting the first node provided in an embodiment of this application, based on... Figure 15 The first node is Figure 15 In node C of node a, the fifth node, which is below the first node and connected to the first node, is as follows: Figure 15As shown in the dashed box 1501 in section a, it includes nodes D, H, E, F, and G; therefore, when node C is deleted, all nodes connected to the first node and their corresponding nodes will also be deleted, as well as the relative paths between node C and all such nodes, as shown in section a. Figure 15 As shown in b.

[0152] In practice, node deletion can also be performed after updating the relative paths in the document's tree structure based on the changed page structure. Specifically, when the page structure changes because a node deletion operation is triggered in the document, the third node to be deleted in the document is identified; the nodes located below the level of the third node are searched in the tree structure; from the nodes below the level of the third node, the fourth node that has a connection relationship with the third node is selected; the relative paths of the third node and the fourth node are searched in the document's tree structure, and the third node, fourth node, relative path of the third node, and relative path of the fourth node are deleted from the tree structure.

[0153] It should be noted that the process of selecting the fourth node, which is connected to the third node, from the nodes below the third node's level is similar to the process of selecting the fifth node, which is connected to the first node, from the nodes below the first node's level, as described earlier. This will not be repeated here. The third node can be any node in the tree structure. As mentioned earlier, the connections here include direct and indirect connections. After deleting the first node, all nodes below the third node that are connected to the first node are also deleted, i.e., the fourth node.

[0154] In other embodiments, the process of updating the relative path in the document's tree structure based on the changed page structure may involve creating a first node and its relative path in the tree structure when the page structure changes because a node creation operation is triggered in the document.

[0155] It should be noted that when the page structure changes because a node creation operation is triggered in the document, the process of finding the relative path of the first node in the document's tree structure is as follows: the relative path of the first node is determined based on the position of the newly created first node in the tree structure; at the same time, if there are other nodes below the first node whose page nodes have changed, the relative paths of the other nodes will also be updated.

[0156] Specifically, the process of determining other nodes whose page nodes have changed involves obtaining the relative paths of each other node connected to the first node at the same level in the tree structure; matching the relative paths of the first node with the relative paths of each other node to obtain matching results; identifying other nodes whose relative paths intersect with the relative paths of the first node as the other nodes whose page nodes have changed based on the matching results; and updating the relative paths of other nodes by updating the relative paths of the corresponding other nodes to paths pointing from the first node to the corresponding other nodes.

[0157] It should be noted that the process of determining every other node in the hierarchy below the first node that is connected to the first node is similar to the process described earlier of selecting the fifth node from the nodes in the hierarchy below the first node that is connected to the first node, and will not be repeated here. At the same time, if the newly created node is a data node, it will not cause any changes to the page structure. Only when the newly created node is a page node will it cause any changes to the page structure. Therefore, the first node here is a page node.

[0158] For example, see Figure 16 , Figure 16 This is a schematic diagram of the newly created first node provided in the embodiments of this application, based on Figure 16 ,exist Figure 16 In node a, a new page node K is created between node I and node J. Simultaneously, since there are other nodes below node C whose page nodes have changed (i.e., node J), ​​the relative path of node J will also be updated, meaning the relative path of node J will be changed from... Figure 16 As shown in a, IJ becomes as Figure 16 KJ is shown in b.

[0159] In practice, after updating the relative paths in the document's tree structure based on the changed page structure, a node creation operation can be performed. Specifically, when the page structure changes because a node creation operation is triggered in the document, the newly created sixth node in the document is identified; the nodes located below the sixth node's level and connected to the sixth node are searched in the tree structure; from the nodes below the sixth node's level and connected to the sixth node, the seventh node whose page node has changed is selected; the first node and its relative path are created in the tree structure, and the relative path of the seventh node is searched; the relative path of the seventh node is updated to the path pointing from the sixth node to the seventh node.

[0160] It should be noted that if the newly created node is a data node, it will not change the page structure. Only when the newly created node is a page node will it change the page structure. Therefore, the sixth node here is a page node. The connection relationships here, as mentioned above, include direct connection relationships and indirect connection relationships. At the same time, from the nodes below the sixth node's level that have a connection relationship with the sixth node, the seventh node whose page node has changed is selected. That is, the relative path of the first node is matched with the relative path of each node below the sixth node's level that has a connection relationship with the sixth node to obtain the matching results. Based on the matching results, the node whose relative path intersects with the relative path of the first node is determined as the seventh node.

[0161] It should be noted that the process described above, which involves determining the nodes connected to any given node at its hierarchical level, is similar to the process described above, which involves selecting the fifth node connected to the first node from among the nodes at the first node's hierarchical level. The technical effects achieved are also the same, and the relevant parts will not be elaborated upon further.

[0162] In some embodiments, the tree structure can be updated directly based on path matching without searching for the target second node. Specifically, after updating the relative paths in the document's tree structure based on the changed page structure, the relative paths of each second node in the hierarchy below the first node can be obtained, and the path prefix of each relative path can be determined. For each path prefix, the path prefix is ​​matched with the relative path of the first node before the update to obtain the matching result. Based on the matching result, the relative path corresponding to the path prefix that intersects with the relative path of the first node is determined as the target relative path, and the target relative path is updated.

[0163] It should be noted that for each second node, the path prefix refers to the path from the page node to which the corresponding second node belongs to the parent node of the second node. When the second node and its page node are adjacent levels, the path prefix of the second node is also the second node and its page node. In other words, the path prefix refers to the path part obtained by deleting the second node from the relative path.

[0164] In practice, the process of updating the target relative path can be as follows: when the first node is a page node, update the path prefix of the target relative path to the first node; when the first node is a data node, update the target relative path based on the new relative path of the first node.

[0165] It should be noted that when the first node is a page node, the process of updating the relative path of the target second node to the path from the first node to the target second node can be as follows: In response to a change in the page structure caused by a move operation on the first node triggered in the document, the path prefix of the target relative path is updated to the first node; or in response to a change in the page structure caused by a type conversion operation on the first node triggered in the document, the path prefix of the target relative path is updated to the first node.

[0166] When the first node is a data node, the process of updating the target relative path based on the new relative path of the first node can be as follows: In response to a change in the page structure caused by a move operation on the first node triggered in the document, the path prefix of the target relative path is updated to the relative path of the first node; In response to a change in the page structure caused by a type conversion operation on the first node triggered in the document, if there is a data node between the first node and its page node, and the second node corresponding to the target relative path is a data node, then the path prefix of the target relative path is updated to the page node to which the first node belongs.

[0167] If there are data nodes between the first node and its page node, and the second node corresponding to the target relative path is a page node, then the path prefix of the target relative path is updated to the updated new relative path of the first node. As mentioned above, in this application, for a data node, its child nodes cannot be data nodes, and its parent nodes cannot be data nodes either. There can only be data nodes with indirect connection relationships. Therefore, the new relative path of the first node is the path from the page node to the first node, and the path of the existing data nodes has been deleted.

[0168] If there is no data node between the first node and its page node, and the second node corresponding to the target relative path is a page node, then the path prefix of the target relative path is updated to the updated new relative path of the first node. Since there is no data node between the first node and its page node, the relative path of the first node is not updated when the first node changes from a page node to a data node. That is, the relative path of the first node before and after the update is the same, which is equivalent to the path prefix of the target relative path remaining unchanged, that is, the target relative path remaining unchanged.

[0169] If there is no data node between the first node and its page node, and the second node corresponding to the target relative path is a data node, then the path prefix of the target relative path will be updated to the page node to which the first node belongs.

[0170] It should be noted that if the page structure changes because a type conversion operation on the first node is triggered in the document, then "when the first node is a data node or a page node" here refers to the case where the first node after type conversion is a data node or a page node.

[0171] At the same time, the path prefix of the target relative path is updated to the page node to which the first node belongs, which is equivalent to promoting the second node corresponding to the target relative path to the same level as the first node; the path prefix of the target relative path is updated to the new relative path of the first node, which is equivalent to promoting the second node corresponding to the target relative path to the next level of the page node to which the first node belongs.

[0172] In some embodiments, when the page structure changes because a new node creation operation is triggered in the document, the first node can only be a page node. The process of updating the tree structure based on path matching can be as follows: based on the new location of the first node, find the path prefix of the first node; obtain the relative path of each second node in the hierarchy below the first node, and determine the path prefix of each relative path; match the path prefix of the first node with the path prefix of each second node below the first node to obtain the matching result; based on the matching result, select the path prefix of the second node that is the same as the path prefix of the first node, and determine the relative path corresponding to the selected path prefix as the target relative path, and update the target relative path.

[0173] The process of updating the target relative path involves updating the path prefix of the target relative path to the relative path of the first node.

[0174] In some embodiments, when the page structure changes because a deletion operation on the first node is triggered in the document, the process of updating the tree structure based on path matching may involve: obtaining the relative path of each second node in the level below the first node, and determining the path prefix of each relative path; when the first node is a page node, matching the first node with the path prefix of each relative path to obtain a matching result; based on the matching result, selecting the path prefix of the second node that intersects with the first node; when the first node is a data node, matching the relative path of the first node with the path prefix of each determined relative path to obtain a matching result; based on the matching result, selecting the path prefix of the second node that has the same relative path as the first node; then, for the selected path prefix, performing the same processing as the first node on the second node corresponding to the selected path prefix; and so on, until the last level of the tree structure, deleting the node corresponding to the selected path prefix and its corresponding relative path.

[0175] In this way, relative paths in the tree structure can be updated in batches based on path prefixes, which improves the update efficiency of the tree structure.

[0176] In some embodiments, the document includes a page management area for displaying and managing the connection relationships between multiple pages; thus, based on the changed page structure, after updating the relative paths in the document's tree structure, data nodes in the updated tree structure can be deleted to obtain the target tree structure; based on the target tree structure, the connection relationships between multiple pages in the page management area are updated.

[0177] It should be noted that the page management area is used to display the connection relationships between multiple pages. Since the connection relationships between pages are related to page nodes, updating the page management area only needs to be based on page nodes. Therefore, after updating the relative paths in the document's tree structure based on the changed page structure, the data nodes in the updated tree structure are deleted. Thus, based on the obtained target tree structure, the connection relationships between multiple pages in the page management area are updated.

[0178] For example, see Figure 17 , Figure 17 This is a schematic diagram of the page management area updated based on the target tree structure provided in an embodiment of this application. Figure 17 , Figure 17 The 'a' indicates the tree structure before the document was updated, thus when deletion... Figure 17 When node C is in a, the tree structure is updated as follows: Figure 17 As shown in b; then delete the data nodes in the updated tree structure to obtain as shown in [the diagram]. Figure 17 The target tree structure is shown in c, where, since the updated tree structure has no data nodes, the updated structure is as follows: Figure 17 The tree structure shown in b is similar to... Figure 17 The target tree structure shown in c is the same; therefore, based on the obtained target tree structure, the connection relationships between multiple pages in the page management area are updated; where... Figure 17 The dashed box 1701 in 'd' shows the page management area corresponding to the tree structure before the update, while... Figure 17 The dashed box 1702 in e represents the page management area corresponding to the target tree structure, which is also the updated page management area.

[0179] In practice, after deleting data nodes in the updated tree structure to obtain the target tree structure, the target tree structure is sent to the terminal. The terminal then displays the updated page management area based on the target tree structure. Here, the page management area is used to display the connection relationship between multiple pages, that is, to display the page structure of the document.

[0180] It should be noted that, as mentioned earlier, while updating the relative path of the first node in the tree structure based on changes in the page structure, there will also be other nodes below the first node whose page nodes have changed. Therefore, the relative paths of these other nodes in the tree structure will also be updated. Thus, the process of deleting data nodes in the updated tree structure to obtain the target tree structure refers to the updated tree structure obtained after updating the relevant paths of the first node and other nodes below the first node whose page nodes have changed.

[0181] In some embodiments, the document processing method provided in this application is implemented through front-end and back-end collaboration. Specifically, in response to a display operation on a document, the front-end displays the document content in the page content editing area and the page structure in the page management area. In response to a document editing operation triggered in the page content editing area and / or the page management area, when the document editing operation causes a change in the page structure, the front-end sends a page structure update request to the back-end. Thus, in response to a change in the page structure of a document including multiple pages, the back-end determines the first node that caused the change in the page structure. The first node includes at least one of the following: the page node corresponding to the page and the data node corresponding to the data in the page. The back-end obtains the tree structure of the document, which is constructed based on the page node and the data node. The back-end searches for the relative path of the first node in the document's tree structure. The relative path is the path from the page node to which the first node belongs to the first node. Based on the changed page structure, the back-end updates the relative path in the document's tree structure and sends the updated tree structure to the front-end. Finally, the front-end displays the changed page structure in the page management area based on the updated tree structure.

[0182] It should be noted that the backend processing described above is similar to steps 101 to 104 described above, and will not be repeated here in this embodiment; at the same time, the relative paths of other nodes below the level of the first node in the tree structure whose page nodes have changed will also be updated during the backend processing, and will not be repeated here either.

[0183] In some embodiments, the document processing method provided in this application is implemented through a front-end; specifically, in response to a display operation on a document, the front-end displays the document content in the page content editing area and the page structure of the document in the page management area; receives a document editing operation triggered in the content editing area and / or the page management area that causes a change in the page structure; in response to a change in the page structure of a document including multiple pages, determines a first node that causes the change in the page structure, the first node including at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page; obtains the tree structure of the document, the tree structure being constructed based on the page nodes and data nodes; searches for the relative path of the first node in the tree structure of the document, the relative path being the path from the page node to which the first node belongs to the first node; updates the relative path in the tree structure of the document based on the changed page structure, and displays the changed page structure in the page management area based on the updated tree structure.

[0184] It should be noted that the process of updating the relative paths in the document's tree structure based on the changed page structure after the page structure of a document comprising multiple pages changes is similar to the process described in steps 101 to 104 above, and will not be repeated here in this embodiment; at the same time, the relative paths of other nodes in the tree structure that are below the level of the first node and whose page nodes have changed will also be updated during the above front-end processing, and will not be repeated here either.

[0185] In some embodiments, it can also be provided by Figure 1 Terminal 400 in the application executes the document processing method provided in the embodiments of this application independently. See also Figure 18 , Figure 18 This is a flowchart illustrating the document processing method provided in the embodiments of this application, which will be combined with... Figure 18 The steps shown are explained.

[0186] Step 301: The terminal displays a page management area that includes the page structure of the document, and a page content display area that includes the page content of the target page.

[0187] In actual implementation, the terminal responds to a display instruction for a target page in a document by displaying a page management area that includes the document's page structure and a page content display area that includes the target page's content. The page structure displayed in the page management area is the access path of the target page. Specifically, upon receiving a display instruction for the target page, the terminal queries the access path of the target page based on the pre-stored document tree structure. Based on the access path, the terminal displays a page management area that includes pages at the same level as the pages associated with the access path, and displays a page content display area that includes the target page's content.

[0188] It should be noted that an "opening link" refers to the path from the page node corresponding to the target page to the root node of the tree structure. Since the terminal updates the page structure based on the target tree structure with deleted data nodes, all nodes traversed in the opening link are page nodes. The page associated with the opening link refers to the page corresponding to the page node traversed by the opening link, while the page at the same level as the page associated with the opening link refers to the page corresponding to the page node at the same level as the page node associated with the opening link.

[0189] It should be noted that the process of querying the access link of the target page based on the pre-stored document tree structure is to determine the relative path of the page node corresponding to the target page, and based on the relative path, determine the page node to which the page node belongs. Then, for the page node to which the page node belongs, based on the relative path of the page node to which the page node belongs, determine the page node to which the page node to which the page node belongs; and so on, until the root node of the tree structure is reached. Based on these determined page nodes, the access link of the target page is generated. At the same time, these determined page nodes are identified as the page nodes through which the access link passes.

[0190] In some embodiments, the page node corresponding to the same level page of the page associated with the opening link can be determined directly based on the page node to which the node belongs. After querying the opening link of the target page, the relative path of each page node in the tree structure is obtained based on the page nodes traversed by the opening link. Then, based on the relative path of each page node, the page node to which each page node belongs is determined. For each page node traversed by the opening link, the page node to which each page node belongs in the tree structure is matched with the page node to which the corresponding page node traversed by the opening link belongs. Based on the matching result, the page nodes in the tree structure that are at the same level as the corresponding page node traversed by the opening link are determined. Then, these page nodes are determined as the page nodes corresponding to the same level page of the page associated with the opening link.

[0191] It should be noted that, as mentioned above, since the terminal updates the page structure based on the target tree structure with data nodes deleted, all nodes in the open link are page nodes. At the same time, the relative path of each page node in the tree structure is obtained, which is also the relative path of each page node in the target tree structure.

[0192] Specifically, when the matching result indicates that the page node to which the corresponding page node through which the link is initiated matches the page node to which the corresponding page node in the tree structure belongs, the page node in the tree structure corresponding to the matching result is determined to be a page node at the same level as the corresponding node through which the link is initiated.

[0193] In other embodiments, the page nodes corresponding to the same level pages of the pages associated with the opening link can be determined directly based on prefix matching. After querying the opening link of the target page, the relative path of each page node is obtained based on the page nodes traversed by the opening link. Then, based on the relative paths of the page nodes in the tree structure and the relative paths of the page nodes traversed by the opening link, prefix matching is performed on the page nodes in the tree structure and the page nodes traversed by the opening link. Based on the matching results, page nodes at the same level as the page nodes traversed by the opening link are determined. These page nodes are then determined as the same level page nodes of the pages associated with the opening link.

[0194] It should be noted that, as mentioned above, since the terminal updates the page structure based on the target tree structure with data nodes deleted, all nodes in the open link are page nodes. At the same time, the relative path of each page node is obtained, which is the relative path of each page node in the target tree structure.

[0195] Here, since the relative path of a node refers to the path from the page node to which the node belongs to that node, the process of performing prefix matching between the page nodes in the tree structure and the page nodes through which the opening link passes, based on the relative paths of the page nodes in the tree structure and the relative paths of the page nodes through which the opening link passes, can be as follows: Based on the relative paths of the page nodes in the tree structure and the relative paths of the page nodes through which the opening link passes, determine the path prefix of the page nodes in the tree structure and the path prefix of the page nodes through which the opening link passes; match the path prefix of the page nodes in the tree structure with the path prefix of the page nodes through which the opening link passes; and based on the matching result, determine the page nodes at the same level as the page nodes through which the opening link passes, which can be as follows: When the matching result indicates that the path prefix of the page nodes through which the opening link passes is the same as the path prefix of the corresponding node, determine that the corresponding node is a node at the same level as the page nodes through which the opening link passes.

[0196] It should be noted that the definition of path prefixes is as described above and will not be repeated here. For example, if the relative path of node D is CD and the relative path of node E is CE, then the process of performing prefix matching on nodes D and E based on the relative paths of node D and node E is to determine that the path prefix of node D is the page node C to which node D belongs, i.e., C, and to determine that the path prefix of node E is the page node C to which it belongs, i.e., C. Thus, the path prefix of node D is matched with the path prefix of node E to obtain the matching result. When the matching result indicates that the path prefix of the page node through which the link is initiated is the same as the path prefix of the corresponding node, the corresponding node is determined to be a node of the same level as the page node through which the link is initiated.

[0197] For example, see Figure 19 , Figure 19 This is a schematic diagram illustrating the process of displaying a page management area based on a display instruction for a target page in a document, provided in an embodiment of this application. Figure 19 For example Figure 19 The document corresponding to the tree structure shown in Figure 'a' has node D as the target page. Responding to display instructions for the target page, the document displays as follows: Figure 19 The dashed box 1901 in b indicates the page management area that includes the document's page structure, and such as Figure 19 The area indicated by the dashed box 1902 in b is the page content display area that includes the page content of the target page; where, Figure 19 The dashed box 1903 in b indicates the text content corresponding to the data node, that is... Figure 19 In node a, data node E is the parent page node of node D, so the back button in dashed box 1902 is used to return to page A. The page node of the child node of node D is node F, so a control for switching to page F is displayed in dashed box 1902, as shown in dashed box 1904.

[0198] like Figure 19 As shown, when the target page is page D, based on the tree structure, the starting link is determined to be AD, and the pages associated with the starting link are page A and page D. The sibling pages of the pages associated with the starting link are page B (the sibling page of page A) and page I (the sibling page of page D). Based on this, after determining the page nodes corresponding to the sibling pages of the pages associated with the starting link, a page management area including the sibling pages of the pages associated with the starting link is displayed, along with a page content display area including the page content of the target page, as shown below. Figure 19 As shown in b.

[0199] In this case, the terminal displays the page management area based on the target tree structure with data nodes deleted, but for ease of understanding, Figure 19 The tree structure shown in Figure 'a' is a tree structure without deleted data nodes. For ease of understanding, the tree structures described in the examples below are also tree structures without deleted data nodes. However, in actual applications, when the terminal displays the page management area, it is based on the target tree structure with deleted data nodes.

[0200] In this way, based on the relative path of the nodes, the access path to the target page can be quickly deduced, and the access path to the target page can be quickly displayed in the page management area. Compared with the method of traversing the tree structure layer by layer to determine the access path to the target page, the computational cost is reduced and the efficiency of determining the access path to the target page is improved.

[0201] Step 302: In response to a document editing operation that changes the page structure of the document, the page structure after the change based on the document editing operation is displayed in the page management area; wherein the document editing operation is triggered based on at least one of the page management area and the page content display area.

[0202] In practice, as mentioned above, document editing operations include node deletion, node movement, node type conversion, and node creation. Next, we will explain the process of displaying the changed page structure in the page management area in response to document editing operations that change the page structure of the document, for different types of document editing operations.

[0203] In some embodiments, the document editing operation is a node deletion operation. Therefore, in response to a document editing operation that changes the page structure of the document, the process of displaying the changed page structure in the page management area based on the document editing operation may involve: in response to a node deletion operation that changes the page structure of the document, determining the target node to be deleted, and other nodes below the target node that are connected to the target node; when there are page nodes among the other nodes and the target node is a page node, deleting the target node and the page nodes among the other nodes in the page management area; when there are no page nodes among the other nodes and the target node is a page node, deleting the target node in the page management area; when there are page nodes among the other nodes and the target node is a data node, deleting the page nodes among the other nodes in the page management area.

[0204] It should be noted that if the target node is a data node and there are no page nodes among other nodes connected to the target node at the same level, the node deletion operation will not cause changes to the page structure. Therefore, in response to document editing operations that change the page structure of the document, the process of displaying the page structure after the changes based on the document editing operation in the page management area does not include the case where there are no page nodes among other nodes and the target node is a data node.

[0205] Meanwhile, the process of determining other nodes below the target node in the same hierarchy and connected to the target node is similar to the process described above of selecting the fifth node connected to the first node from the nodes below the first node in the same hierarchy, and the technical effect achieved is the same, so it will not be elaborated here.

[0206] When deleting a target node or page nodes in other nodes, the target node and / or page nodes in other nodes may not be displayed in the page management area, but may be in a collapsed state. Therefore, the process of deleting the target node and page nodes in other nodes may not be displayed in the page management area. The process of deleting the target node and page nodes in other nodes will only be displayed in the page management area when the target node and page nodes in other nodes are in an expanded state.

[0207] For example, see Figure 20 , Figure 20 This is a schematic diagram of deleting a target node provided in an embodiment of this application, based on... Figure 20 Figure a corresponds to Figure c, and Figure b corresponds to Figure d. The target node to be deleted is node I. Since the page content display area does not display any content related to page I, the deletion operation for the target node is performed in the page management area; for example... Figure 20 As shown, in response to Figure 20 The deletion operation of node I in the dashed box 2001 in Figure c deletes node I in the page management area, thus the page management area is as shown in the dashed box 2002 in Figure d; and regarding the document's tree structure, the tree structure shown in Figure a corresponds to that in Figure c, therefore, upon receiving the request for... Figure 20 When node I is deleted from the dashed box 2001 in document c, its child node J, the relative path of node I, and the relative path of node J are also deleted. Therefore, the document's tree structure will be updated as follows: Figure 20 As shown in Figure b, the data nodes in the tree structure shown in Figure b are then deleted to obtain the target tree structure. Based on this target tree structure, the page management area is updated to the dashed box 2002 in Figure d.

[0208] In some embodiments, the document editing operation is a node creation operation. In response to the document editing operation for changing the page structure of the document, the process of displaying the page structure after the change based on the document editing operation in the page management area may include determining the position of the newly created target node in response to the node creation operation for changing the page structure of the document; and adding the target node at the corresponding position in the page management area.

[0209] It should be noted that determining the location of the newly created target node also means determining the target node's parent node and other nodes below the target node in the same hierarchy that are connected to the target node. Therefore, the process of adding a target node at the appropriate location in the page management area can be as follows: when the parent node is a page node and other nodes contain page nodes, add the target node between the parent node and the page nodes in the other nodes in the page management area; when the parent node is a data node and other nodes contain page nodes, add the target node between the page node to which the parent node belongs and the page nodes in the other nodes in the page management area; when the parent node is a page node and other nodes do not contain page nodes, add the target node at the next level below the parent node in the page management area.

[0210] It should be noted that if the parent node is a data node and there are no page nodes among the other nodes connected to the target node at the same level, the node creation operation will not cause changes to the page structure. Therefore, in response to document editing operations that change the page structure of the document, the process of displaying the page structure after the changes based on the document editing operation in the page management area does not include the case where the parent node is a data node and there are no page nodes among the other nodes.

[0211] It should be noted that, when adding a target node between a parent node and other page nodes in the page management area, the target node is at the next lower level of the parent node and at the upper level of the other page nodes. Similarly, when adding a target node between a parent node and other page nodes in the page management area, the target node is at the next lower level of the parent node and at the upper level of the other page nodes. If there are multiple page nodes in the other nodes, the upper level of the other page nodes refers to the upper level of the highest-level page node among them.

[0212] When there are multiple page nodes in other nodes, the relative positional relationship, i.e., the connection relationship, of these multiple page nodes remains unchanged. Furthermore, the process of determining other nodes below the target node in the hierarchy that are connected to the target node is similar to the process described earlier of selecting the fifth node connected to the first node from among the nodes below the first node in the hierarchy, and the achieved technical effect is the same; therefore, it will not be elaborated upon here.

[0213] For example, see Figure 21 , Figure 21 This is a schematic diagram of a newly created target node provided in an embodiment of this application, based on... Figure 21Figure a corresponds to Figure c, and Figure b corresponds to Figure d. The newly created target node is node K. Since node K is created at the next level below node A, and the page content display area does not display any content related to page A, the creation operation for the target node is performed in the page management area; for example... Figure 21 As shown, in response to Figure 21 The node creation operation performed within the dashed box 2101 in Figure c creates a new node K in the page management area, resulting in the page management area as shown in the dashed box 2102 in Figure d. Regarding the document's tree structure, the tree structure shown in Figure a corresponds to that in Figure c. Therefore, upon receiving a request for… Figure 21 When a new node is created within the dashed box 2101 in C, the document's tree structure will be updated as follows. Figure 21 As shown in Figure b, the data nodes in the tree structure shown in Figure b are then deleted to obtain the target tree structure. Based on this target tree structure, the page management area is updated to the dashed box 2102 in Figure d.

[0214] In some embodiments, a document editing operation is a node movement operation. In response to a document editing operation that changes the page structure of a document, the process of displaying the changed page structure in the page management area based on the document editing operation may involve, in response to a node movement operation that changes the page structure of a document, determining the target node to be moved, and other nodes below the target node that are connected to it; when there are page nodes among the other nodes and the target node is a page node, moving the target node and the page nodes among the other nodes from their initial positions to the target position in the page management area; when there are page nodes among the other nodes and the target node is a data node, moving the page nodes among the other nodes from their initial positions to the target position in the page management area; and when there are no page nodes among the other nodes and the target node is a page node, moving the target node from its initial position to the target position in the page management area.

[0215] It should be noted that if the target node is a data node and there are no page nodes among the other nodes connected to the target node at the same level, the node movement operation will not cause a change in the page structure. Therefore, in response to a document editing operation that changes the page structure of the document, the process of displaying the page structure after the change based on the document editing operation in the page management area does not include the case where the target node is a data node and there are no page nodes among the other nodes.

[0216] For a target node, when the target node is a page node, the initial position is the level of the target node in the page management area before the target node moves, and the target position is the level below the level of the page node to which the target node belongs in the page management area after the target node moves. The relative positional relationship between the target node and other page nodes remains unchanged. At the same time, when there are multiple page nodes in other nodes, the relative positional relationship, i.e., the connection relationship, of the multiple page nodes also remains unchanged.

[0217] For page nodes within other nodes, when the target node is a page node, the initial position is the level below the target node's level before the target node moves. The target position is the level below the target node's level after the target node moves. When the target node is a data node, the initial position is the level below the target node's level before the target node moves. The target position is the level below the target node's level after the target node moves. When there are multiple page nodes within other nodes, the relative positions and connections between them remain unchanged.

[0218] The process of determining other nodes below the target node in the hierarchy and connected to the target node is similar to the process described above of selecting the fifth node connected to the first node from the nodes below the first node in the hierarchy, and the technical effect achieved is the same, so it will not be elaborated here.

[0219] For example, see Figure 22 , Figure 22 This is a schematic diagram of a moving target node provided in an embodiment of this application, based on... Figure 22 Figure a corresponds to Figure c, and Figure b corresponds to Figure d. The target node to be moved is node D. Since node D is displayed in both the page content display area and the page management area, the movement operation on the target node can be performed in either the page management area or the page content display area; for example... Figure 22 As shown, in response to Figure 22The movement operation of node D in dashed box 2201 in Figure c moves node D from the next level of node A to the next level of node I, as shown in dashed box 2202 in Figure d in the page management area. Since node D is now at the same level as node J, the page corresponding to node J will also be displayed in the page management area. Furthermore, the page node to which node D belongs after the movement becomes node I. Therefore, as shown in dashed box 2203, the return button is used to return to page I. Regarding the document's tree structure, the tree structure shown in Figure a corresponds to that in Figure c. Therefore, upon receiving a request for… Figure 22 When node D in the dashed box 2201 of document c is moved, the document's tree structure will be updated as follows: Figure 22 As shown in Figure b, the data nodes in the tree structure shown in Figure b are then deleted to obtain the target tree structure. Based on this target tree structure, the page management area is updated to the dashed box 2202 in Figure d.

[0220] It should be noted that for page nodes in a collapsed state, the target node cannot be moved to the next level in one go. Only when the corresponding node is in an expanded state, that is, displayed in the page management area, can the target node be moved to the next level in one go. For example, see [link to example]. Figure 22 When node J is in a collapsed state, that is, not displayed in the page management area, node D cannot move to the next level of node J in one go unless node J is expanded, that is, node J is displayed in the page management area. Only then can node D be moved to the next level of node J in one go.

[0221] In other embodiments, the document editing operation is a node type conversion operation. In response to a document editing operation that changes the page structure of the document, the process of displaying the changed page structure in the page management area based on the document editing operation may involve: determining the target node to be converted in response to the node type conversion operation that changes the page structure of the document; when the type of the target node is converted from a page node to a data node, de-displaying the target node in the page management area; and when the type of the target node is converted from a data node to a page node, displaying the added target node in the page management area.

[0222] It should be noted that when determining the target node to be transformed, other nodes below the target node and connected to it are also identified. Therefore, when the target node's type changes from a page node to a data node, and page nodes exist among other nodes, the target node is removed from the page management area, and the page nodes in the other nodes are moved from the level below the target node to the level of the target node. When the target node's type changes from a page node to a data node, and no page nodes exist among other nodes, the target node is only removed from the page management area. When the target node's type changes from a data node to a page node, and page nodes exist among other nodes, the newly added target node is displayed at the level below the page node to which the target node belongs in the page management area, and the page nodes in the other nodes are moved from the level below the page node to the level below the target node. When the target node's type changes from a data node to a page node, and no page nodes exist among other nodes, the newly added target node is displayed at the level below the page node to which the target node belongs in the page management area.

[0223] When there are multiple page nodes in other nodes, the relative positional relationship, i.e., the connection relationship, of these multiple page nodes remains unchanged. Furthermore, the process of determining other nodes below the target node in the hierarchy that are connected to the target node is similar to the process described earlier of selecting the fifth node connected to the first node from among the nodes below the first node in the hierarchy, and the achieved technical effect is the same; therefore, it will not be elaborated upon here.

[0224] For example, see Figure 23 , Figure 23 This is a schematic diagram illustrating the type of the conversion target node provided in the embodiments of this application, based on Figure 23 Figure a corresponds to Figure c, and Figure b corresponds to Figure d. The target node for type conversion is node E. Since node E is a data node, as shown by the dashed box 2301 in Figure c, node E does not exist in the page management area. Therefore, the type conversion operation for the target node is performed in the page content display area. Figure 23 As shown, in response to Figure 23 The type conversion operation for node E in dashed box 2301 in c transforms node E from a data node to a page node. Since page E is collapsed, the page corresponding to the type-converted node E is not displayed in the page management area. Regarding the document's tree structure, the tree structure shown in Figure a corresponds to that in Figure c; therefore, upon receiving a request for… Figure 23 When performing a type conversion operation on node E of the dashed box 2301 in document c, the document's tree structure will be updated as follows: Figure 23As shown in Figure b, the data nodes in the tree structure shown in Figure b are then deleted to obtain the target tree structure. Based on this target tree structure, the page management area is updated as shown in Figure d, and the page node E after type conversion is shown in the dashed box 2302 in Figure d.

[0225] By applying the embodiments described above, when the page structure of a document comprising multiple pages changes, the nodes causing the change are identified. Then, the relative paths of these nodes are searched within the tree structure constructed from page nodes and data nodes. Based on the changed page structure, the relative paths in the document's tree structure are updated. Thus, when the document's page structure changes, processing is performed based on a tree structure including page nodes and data nodes. Compared to related technologies that process documents based on a tree structure that excludes data nodes and only includes page nodes, this improves the accuracy of document processing. Furthermore, when the document's page structure changes, it is not necessary to completely traverse the original document's tree structure to update it; instead, the tree structure can be quickly updated based on the relative paths of nodes, improving document processing efficiency when the page structure changes.

[0226] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.

[0227] In related technologies, when a user browses a document that includes multiple pages, the system will obtain all the tree structure data of the document and then calculate the directory hierarchy structure corresponding to the multiple pages in real time for display. Alternatively, the system can directly remove the data nodes in the tree structure of the document to form a separate tree structure that retains only the page nodes. This separate tree structure is then used to maintain the page structure of the document when the page structure of the document changes.

[0228] However, the first method is computationally expensive, consuming significant machine resources. Furthermore, its success rate is low when dealing with complex directories and large datasets. The second method suffers from lower accuracy when the page's tree structure loses interspersed data nodes. Editing data nodes within the document cannot affect the page structure, leading to lower accuracy when the document's page structure changes. Additionally, changes to the page structure require updating the tree structure based on the updated structure to determine the corresponding directory hierarchy for multiple pages. However, simply retaining the individual tree structure of page nodes cannot be quickly updated from the original document; the entire original document's tree structure must be traversed. This further reduces document processing efficiency when the page structure changes.

[0229] Based on this, this application provides a document processing method that records the relative path of each node starting from its respective page. In this way, the paths of nodes at the same level are consistent. No matter how deep the node is in the hierarchy, the page to which the node belongs can be directly known through the path field. Thus, nodes under a certain node can be queried in batches through path matching, and paths can be replaced in batches through path matching. In this way, it is not necessary to perform a lot of calculations on all document data, and the page node structure maintenance will not be difficult due to the loss of data nodes. Instead, page management is maintained by recording very little data such as the path and type of each node, achieving accurate, fast and low-cost technical effects.

[0230] Next, the technical solution of this application will be described from the aspects of editing and opening documents.

[0231] In practice, the page structure is derived from the document structure. Therefore, any change in the document will lead to a change in the page. Since the page can be under any data node, modifying the data node can also affect the page node. Next, we will take three operations on the document (document editing operations) as examples to explain the process of maintaining the page structure when editing the document.

[0232] In some embodiments, when moving any node in a document, the relative path of the node itself needs to be updated after the node is moved, such as... Figure 9 As shown, if data node C is moved after page node I, firstly, the relative path of C itself needs to be modified. Specifically, it is only necessary to replace the 'A' in the relative path AC of data node C based on page node I, so the new relative path of C node can be directly obtained as IC. Then, when moving data node C, the relative paths of all nodes under data node C also need to be modified. For the node paths under node C, path matching can be used to batch replace the prefix (path prefix) of nodes that start with AC- with the new prefix IC- after C is moved. That is, the relative path of page node D under node C will be changed from ACD to ICD, and the relative path of data node H will be changed from ACH to ICH.

[0233] In some embodiments, when deleting any node in a document, such as Figure 7 As shown, when deleting a node, you can simply set the "whether it is alive" value of the corresponding node to "no". For the child nodes of the node being deleted (nodes with connections), you can set the "whether it is alive" value of all child nodes to "no" at once.

[0234] In some embodiments, when performing type conversion on any node in a document, page and data type conversion need to be combined with business performance, but can be quickly replaced by relative path matching rules.

[0235] Taking a product where the document's tree structure changes during type conversion as an example, when a page node is converted into a data node, the page's child nodes are moved to the next higher level. Specifically, the converted page node and its relative path remain unchanged and require no further conversion; only the node type needs to be changed to a data node. However, for the child nodes of the converted page node, since their previous pages no longer exist, their relative paths need to be transformed. The transformation rule is to directly replace the original relative path with the relative path of the converted page node after the conversion. For example... Figure 7 As shown, when converting page node D into a data node, the relative path of page node D remains unchanged, only the type changes. For the node paths under node D, path matching can be used to batch replace the prefixes (path prefixes) of nodes starting with D- with the new prefix AC- of node D after the type change. Since the type of node D changes from page node to data node, the node level under node D will be raised one level. Therefore, the relative path of data node E changes from DH to ACE, and the relative path of page node F changes from DF to ACF.

[0236] When a data node is converted into a page node, the page's child nodes are demoted to the next level. Specifically, when a data type is converted to a page type, the biggest change is that the relative paths of the original data type's child nodes need to start from the new page, such as... Figure 7 As shown, if data node C is converted into a page node, data node C itself only needs to have its data type modified. However, the relative paths of the nodes under data node C need to be replaced. Through path matching, the prefixes (path prefixes) of nodes that start with AC- are replaced in batches with the new prefix C- corresponding to the type-transformed node C. That is, the relative path of page node D changes from ACD to CD, and the relative path of data node H changes from ACH to CH.

[0237] In practical implementation, the main challenge in automatically expanding pages when a document is opened is determining the path of the opened page. Based on this, this application records the relative path for each node, and the first node in the relative path is always the page node to which that node belongs. Therefore, the entire opened path can be determined with just a few queries. For example... Figure 24 As shown, Figure 24 This is a schematic diagram of the process of opening a page provided in an embodiment of this application, based on Figure 24 You need to open page F, such as Figure 24The tree structure shown in Figure 'a' first reveals that page node F belongs to page D. Then, page node D tells us that the parent page is A, and so on. This shows that the path to page F is root-ADF. Relative path matching allows us to quickly find the subpages under each node, enabling rapid page management. Figure 24 As shown in Figure b, the dashed box 2401 represents the page management area, and the dashed box 2402 represents the page content of page F.

[0238] Thus, this application simplifies the process of obtaining data that would otherwise require extensive recursion by using relative paths. Furthermore, based on relative paths, the path prefix of a node is the same as the path prefix of nodes at the same level. This allows for the complete page link to be obtained within a limited number of searches when opening a document. The reduced number of queries not only lowers maintenance costs but also contributes to data accuracy. In addition, the prefix matching achieved based on relative paths significantly reduces the cost of maintaining the page structure and saves on machine connection costs.

[0239] By applying the embodiments described above, when the page structure of a document comprising multiple pages changes, the nodes causing the change are identified. Then, the relative paths of these nodes are searched within the tree structure constructed from page nodes and data nodes. Based on the changed page structure, the relative paths in the document's tree structure are updated. Thus, when the document's page structure changes, processing is performed based on a tree structure including page nodes and data nodes. Compared to related technologies that process documents based on a tree structure that excludes data nodes and only includes page nodes, this improves the accuracy of document processing. Furthermore, when the document's page structure changes, it is not necessary to completely traverse the original document's tree structure to update it; instead, the tree structure can be quickly updated based on the relative paths of nodes, improving document processing efficiency when the page structure changes.

[0240] The following description continues to illustrate the exemplary structure of the document processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the document processing device 455 in the memory 450 may include:

[0241] The determination module 4551 is used to determine a first node that causes the page structure to change in response to a change in the page structure of a document including multiple pages. The first node includes at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page.

[0242] The acquisition module 4552 is used to acquire the tree structure of the document, the tree structure being constructed based on the page nodes and the data nodes;

[0243] The search module 4553 is used to search for the relative path of the first node in the tree structure of the document, wherein the relative path is the path from the page node to which the first node belongs to the first node.

[0244] Update module 4554 is used to update the relative path in the tree structure of the document based on the changed page structure.

[0245] In some embodiments, the apparatus further includes a second search module, which is configured to search for page nodes located above the level of the first node in the tree structure; determine page nodes that are connected to the first node among the found page nodes; and select the page node closest to the first node from the page nodes that are connected to the first node as the page node to which the first node belongs.

[0246] In some embodiments, the update module 4554 is further configured to determine, based on the changed page structure, the new page node to which the first node belongs, and the path from the new page node to the first node; and update the relative path of the first node to the path from the new page node to the first node.

[0247] In some embodiments, the update module 4554 is further configured to, when the reason for the change in the page structure is a move operation triggered on the first node in the document, obtain the parent node of the first node after the move; when the parent node is a page node, determine the parent node as the new page node to which the first node belongs; when the parent node is a data node, determine the page node to which the parent node belongs, and use the page node to which the parent node belongs as the new page node to which the first node belongs.

[0248] In some embodiments, the apparatus further includes a third search module, which is configured to search for a second node that is connected to the first node in a hierarchy below the first node; identify a target second node whose page node has changed among the found second nodes; search for the relative path of the target second node in the tree structure of the document; and update the relative path of the target second node in the tree structure.

[0249] In some embodiments, the reason for the change in page structure is that a type conversion operation for the first node is triggered in the document. The third lookup module is further configured to update the relative path of the target second node based on the path from the new page node to the target second node when the type conversion operation is used to convert the type of the first node from a page node to a data node; and to update the relative path of the target second node to the path from the first node to the target second node when the type conversion operation is used to convert the type of the first node from a data node to a page node.

[0250] In some embodiments, the third lookup module is further configured to update the relative path of the target second node to a path pointing from the first node when the first node is a page node; and to update the relative path of the target second node based on the path pointing from the new page node when the first node is a data node.

[0251] In some embodiments, the third search module is further configured to obtain the relative path of each second node in the tree structure; match the relative path of the first node with the relative path of each second node to obtain a matching result; and based on the matching result, determine the second node whose relative path intersects with the relative path of the first node as the target second node.

[0252] In some embodiments, the apparatus further includes a first deletion module, which is configured to: determine a third node to be deleted in the document when the change in the page structure is caused by a node deletion operation triggered in the document; search for nodes located below the level of the third node in the tree structure; select a fourth node that has a connection relationship with the third node from the nodes below the level of the third node; search for the relative path of the third node and the relative path of the fourth node in the tree structure of the document, and delete the third node, the fourth node, the relative path of the third node, and the relative path of the fourth node in the tree structure.

[0253] In some embodiments, the determining module 4551 is further configured to, in response to a change in the page structure of a document comprising multiple pages, parse the document comprising multiple pages to obtain multiple nodes included in the document; obtain operation information of a document editing operation that causes the change in the page structure; and, based on the operation information, select a first node from the multiple nodes that causes the change in the page structure.

[0254] In some embodiments, the acquisition module 4552 is further configured to parse the document including multiple pages to obtain multiple nodes included in the document; determine the connection relationship between the multiple nodes, and determine the root node of the tree structure corresponding to the document based on the connection relationship between the multiple nodes; construct an initial tree structure including the root node, and add the multiple nodes to the initial tree structure in sequence based on the connection relationship between the multiple nodes to obtain the tree structure of the document.

[0255] In some embodiments, the document includes a page management area for displaying and managing the connection relationships between the plurality of pages; the device further includes a second deletion module for deleting data nodes in the updated tree structure to obtain a target tree structure; and updating the connection relationships between the plurality of pages in the page management area based on the target tree structure.

[0256] This application provides a computer program product including computer-executable instructions or a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions or computer program from the computer-readable storage medium and executes the computer-executable instructions or computer program, causing the electronic device to perform the document processing method described above in this application.

[0257] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the document processing method provided in this application. For example, ... Figure 3 The document processing method is shown.

[0258] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, magnetic surface memory, optical disk, or CD-ROM, etc.; or it may be a device that includes one or any combination of the above-mentioned memories.

[0259] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.

[0260] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).

[0261] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.

[0262] In summary, the embodiments of this application have the following beneficial effects:

[0263] (1) When the page structure of a document changes, the document is processed based on a tree structure that includes page nodes and data nodes. Compared with the related technologies that process documents based on a tree structure that excludes data nodes and only includes page nodes, the accuracy of the document processing process is improved. At the same time, when the page structure of a document changes, it is not necessary to completely traverse the original document's tree structure to update the tree structure. Instead, the tree structure can be updated quickly based on the relative paths of the nodes, which improves the efficiency of document processing when the page structure of a document changes.

[0264] (2) Compared with the method in related technologies that requires traversing layer by layer to select the fifth node that is connected to the first node from the nodes below the first node, the method of selecting the fifth node that is connected to the first node from the nodes below the first node based on the relative path reduces the computational cost and improves the selection efficiency of the fifth node.

[0265] (3) Based on the relative path of the node, the opening link of the target page can be quickly deduced, so the opening link of the target page can be quickly displayed in the page management area. Compared with the method of traversing the tree structure layer by layer to determine the opening link of the target page, the computation cost is reduced and the efficiency of determining the opening link of the target page is improved.

[0266] (4) It does not require all document data to perform a large amount of calculations, nor does it cause difficulties in maintaining the page node structure due to the loss of data nodes. Instead, it maintains page management by recording very little data such as the path and type of each node, achieving accurate, fast and low-cost technical results.

[0267] (5) The relative path simplifies the data that requires a lot of recursion to obtain; at the same time, based on the relative path, the path prefix of the node is the same as the path prefix of the node at the same level. In this way, the search path can be controlled within a limited number of times when opening the document to obtain the complete page link. Moreover, the small number of queries not only reduces maintenance costs but also helps the accuracy of the data. In addition, the prefix matching based on the relative path can significantly reduce the cost of page structure maintenance and save on machine connection costs.

[0268] It should be noted that in this application embodiment, data such as user operation data and tree structure are involved. When this application embodiment is applied to a specific product or technology, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0269] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A document processing method, characterized in that, The method includes: In response to a change in the page structure of a document comprising multiple pages, a first node causing the change in the page structure is determined, the first node including at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page; Obtain the tree structure of the document, which is constructed based on the page nodes and the data nodes; Find the relative path of the first node in the tree structure of the document, where the relative path is the path from the page node to which the first node belongs to the first node. Based on the changed page structure, update the relative path in the document's tree structure.

2. The method as described in claim 1, characterized in that, Before searching for the relative path of the first node in the tree structure of the document, the method further includes: Locate the page node in the tree structure that is at a level above the first node; Identify the page nodes that are connected to the first node from among the found page nodes; From the page nodes that are connected to the first node, select the page node that is closest to the first node as the page node to which the first node belongs.

3. The method as described in claim 1, characterized in that, Updating the relative path in the document's tree structure based on the changed page structure includes: Based on the changed page structure, determine the new page node to which the first node belongs, and determine the path from the new page node to the first node; Update the relative path of the first node to the path of the new page node pointing to the first node.

4. The method as described in claim 3, characterized in that, Determining the new page node to which the first node belongs based on the changed page structure includes: When the page structure changes because a move operation on the first node is triggered in the document, obtain the parent node of the first node after the move. When the parent node is a page node, the parent node is determined as the new page node to which the first node belongs; When the parent node is a data node, determine the page node to which the parent node belongs, and use the page node to which the parent node belongs as the new page node to which the first node belongs.

5. The method as described in claim 3, characterized in that, After updating the relative path in the document's tree structure based on the changed page structure, the method further includes: In the hierarchy below the first node, find the second node that is connected to the first node; Among the found second nodes, identify the target second node whose page node has changed; Find the relative path of the target second node in the tree structure of the document, and update the relative path of the target second node in the tree structure.

6. The method as described in claim 5, characterized in that, The reason for the change in the page structure is that a type conversion operation for the first node was triggered in the document. Updating the relative path of the target second node in the tree structure includes: When the type conversion operation is used to convert the type of the first node from a page node to a data node, the relative path of the target second node is updated based on the path from the new page node to the target second node; When the type conversion operation is used to convert the type of the first node from a data node to a page node, the relative path of the target second node is updated to the path from the first node to the target second node.

7. The method as described in claim 5, characterized in that, Updating the relative path of the target second node in the tree structure includes: When the first node is a page node, the relative path of the target second node is updated to the path from the first node to the target second node; When the first node is a data node, the relative path of the target second node is updated based on the path from the new page node to the target second node.

8. The method as described in claim 5, characterized in that, The step of identifying the target second node whose page node has changed among the found second nodes includes: Obtain the relative path of each of the second nodes in the tree structure; The relative path of the first node is matched with the relative paths of each of the second nodes to obtain the matching results; Based on the matching results, the second node whose relative path intersects with the relative path of the first node is determined as the target second node.

9. The method as described in claim 1, characterized in that, After updating the relative path in the document's tree structure based on the changed page structure, the method further includes: When the page structure changes because a node deletion operation is triggered in the document, the third node that was deleted in the document is identified. Find the node located below the level of the third node in the tree structure; From the nodes at the same level as the third node, select the fourth node that has a connection relationship with the third node; Locate the relative path of the third node and the relative path of the fourth node in the tree structure of the document, and delete the third node, the fourth node, the relative path of the third node, and the relative path of the fourth node from the tree structure.

10. The method as described in claim 1, characterized in that, In response to a change in the page structure of a document comprising multiple pages, determining the first node causing the change in page structure includes: In response to a change in the page structure of a document comprising multiple pages, the document comprising multiple pages is parsed to obtain the multiple nodes included in the document; Obtain operation information of document editing operations that cause changes to the page structure, and select the first node that causes the changes to the page structure from the plurality of nodes based on the operation information.

11. The method as described in claim 1, characterized in that, The step of obtaining the tree structure of the document includes: The document, which includes multiple pages, is parsed to obtain the multiple nodes included in the document; Determine the connection relationships between the multiple nodes, and based on the connection relationships between the multiple nodes, determine the root node of the tree structure corresponding to the document; An initial tree structure including the root node is constructed, and based on the connection relationship between the multiple nodes, the multiple nodes are added to the initial tree structure in sequence to obtain the tree structure of the document.

12. The method as described in claim 1, characterized in that, The document includes a page management area for displaying and managing the connections between the multiple pages; after updating the relative paths in the document's tree structure based on the changed page structure, the method further includes: Delete the data nodes in the updated tree structure to obtain the target tree structure; Based on the target tree structure, update the connection relationships between the multiple pages in the page management area.

13. A document processing apparatus, characterized in that, The device includes: A determination module is configured to, in response to a change in the page structure of a document comprising multiple pages, determine a first node that causes the change in the page structure, wherein the first node includes at least one of the following: a page node corresponding to the page and a data node corresponding to the data in the page; The acquisition module is used to acquire the tree structure of the document, the tree structure being constructed based on the page nodes and the data nodes; The search module is used to search for the relative path of the first node in the tree structure of the document, wherein the relative path is the path from the page node to which the first node belongs to the first node. An update module is used to update the relative paths in the tree structure of the document based on the changed page structure.

14. An electronic device, characterized in that, include: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the document processing method according to any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that, The document contains computer-executable instructions or computer programs for causing a processor to execute, thereby implementing the document processing method according to any one of claims 1 to 12.

16. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, the document processing method according to any one of claims 1 to 12 is implemented.