An electronic archive self-contained processing method and device, and an electronic device

By serializing the document logical structure of electronic archives into content data and compiling the parsing and rendering logic into portable intermediate representation bytecode, which is then encapsulated in the archive file, the problem of autonomous parsing and rendering of electronic archives in heterogeneous environments is solved, achieving long-term preservation stability and autonomous readability.

CN123178345APending Publication Date: 2026-11-27BEIJING NETZHI DESHI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611100444.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In current technologies, the long-term preservation of electronic records is highly dependent on external software environments, which makes it difficult to independently parse and restore them in future heterogeneous environments, posing a risk of them becoming unreadable.

Method used

The document logical structure of electronic archives is serialized into content data, and the parsing and rendering logic is compiled into portable intermediate representation bytecode, which is then encapsulated in the archive file to form a self-contained archive file that can be autonomously parsed and rendered in heterogeneous environments.

Benefits of technology

It achieves autonomous readability and long-term preservation stability of electronic archives in heterogeneous environments, reducing the risk of unreadable data due to software ecosystem changes or hardware transitions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178345A_ABST
    Figure CN123178345A_ABST
Patent Text Reader

Abstract

The application provides an electronic archive self-contained processing method and device and electronic equipment, and relates to the technical field of data processing.The method comprises the following steps: obtaining an electronic archive, extracting a document logical structure and a static resource set from the electronic archive; serializing the document logical structure into content data; compiling parsing and rendering logic for the content data into portable intermediate representation bytecode; encapsulating the portable intermediate representation bytecode, the content data and the static resource set in an archive file, and sending the archive file to a parsing terminal, so that the parsing terminal parses and renders the content data based on the portable intermediate representation bytecode and the static resource set, restores the electronic archive, and enables the archive file to be consistently restored in an incompatible hardware architecture or operating system environment, reduces the risk of unreadable archives caused by software ecological change or hardware change during long-term storage, and improves the autonomous readability and stability of the electronic archive.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and apparatus for self-contained electronic archive processing, and an electronic device. Background Technology

[0002] With the widespread adoption of digital office work, the long-term preservation of electronic records has become a core issue in ensuring the continuity of historical memory and legal evidence. Over a preservation period of decades or even centuries, computer hardware architecture, operating systems, and application software inevitably undergo iterations and become obsolete. How to bridge technological gaps and ensure the readability and authenticity of records in future heterogeneous environments is a major technological challenge currently facing the field of archival management.

[0003] Currently, the industry mainly adopts technical solutions such as format migration, simulation virtualization, and standardized packaging. Format migration extends the life cycle of files by periodically converting them to the current mainstream format; simulation solutions use virtual machine technology to restore the original software and hardware execution environment to open files; and standardized packaging solutions follow the OAIS reference model, encapsulating file data and metadata into standardized data packets, and providing independent structural documentation for future parsing.

[0004] However, existing solutions generally suffer from serious external decoding dependencies in their technical implementation. Since archived files themselves do not have autonomous parsing capabilities, the restoration of their content is highly dependent on specific external decoding toolchains or historical operating system images. When the software ecosystem supporting these tools ceases maintenance or the hardware architecture undergoes fundamental changes, the target system will lack available external parsing programs, resulting in the inability to accurately identify and restore the archived content, making it difficult to achieve long-term autonomous readability of electronic archives in future environments. Summary of the Invention

[0005] This invention provides a self-contained electronic archive processing method, apparatus, and electronic device to address the shortcomings of existing technologies where the long-term preservation of electronic archives is highly dependent on external software environments.

[0006] This invention provides a self-contained electronic archive processing method, executed by an archive generation device, the method comprising: Obtain electronic archives, and extract the document logical structure and static resource set from the electronic archives; Serialize the document's logical structure into content data; The parsing and rendering logic for the content data is compiled into portable intermediate representation bytecode; The portable intermediate representation bytecode, the content data, and the static resource set are encapsulated in an archive file, and the archive file is sent to a parsing terminal so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

[0007] According to the self-contained electronic archive processing method provided by the present invention, the step of compiling the parsing and rendering logic for the content data into portable intermediate representation bytecode includes: During the compilation phase, decoding algorithms for specific content formats in the content data are statically linked to the parsing and execution program; The statically linked parser is compiled into the portable intermediate representation bytecode, so that the decoding algorithm is bound to the content data in the form of the portable intermediate representation bytecode.

[0008] According to the self-contained electronic archive processing method provided by the present invention, the step of serializing the document logical structure into content data includes: The extracted document logical structure is constructed into a self-describing abstract syntax tree; A pattern definition for defining node attributes is embedded in the self-describing abstract syntax tree, and the self-describing abstract syntax tree after embedding the pattern definition is serialized to generate the content data.

[0009] According to the self-contained electronic archive processing method provided by the present invention, the step of encapsulating the portable intermediate representation bytecode, the content data, and the static resource set into an archive file includes: storing the portable intermediate representation bytecode, the content data, and the static resource set in the intermediate representation bytecode area, the content area, and the resource area respectively according to the partition structure, thereby generating the archive file.

[0010] According to the self-contained electronic archive processing method provided by the present invention, the partition structure further includes a host interface specification description area that records the calling permission specification; Before assembling and generating the archive file according to the partition structure, the process also includes: Import function signatures are defined in the host interface specification description area to restrict the access permissions of the portable intermediate representation bytecode to the host environment; The import function signature includes at least one of the following: a pixel write function for writing data to the frame buffer provided by the host, a resource read function for reading data from the archive file, an error reporting function for reporting errors, and a memory request function for allocating linear memory for the portable intermediate representation bytecode.

[0011] According to the self-contained electronic archive processing method provided by the present invention, when generating the archive file, the method further includes: calculating the hash value of each partition based on the partition structure to generate a partition hash chain; storing the partition hash chain and the digital signature for the archive file in the metadata and signature area respectively, so that the parsing terminal can perform integrity verification on the archive file before restoring the electronic archive.

[0012] This invention provides a self-contained electronic archive processing method, executed by a parsing terminal. The method includes: obtaining an archive file, wherein the archive file includes portable intermediate representation bytecode, content data, and a set of static resources. A host is loaded to run the portable intermediate representation bytecode. The portable intermediate representation bytecode is run through the host to read the content data and the static resource set. Based on the portable intermediate representation bytecode and the static resource set, the content data is parsed and rendered to output the restored electronic archive.

[0013] According to the self-contained electronic archive processing method provided by the present invention, the step of loading a host for running the portable intermediate representation bytecode and running the portable intermediate representation bytecode through the host includes: The host extracts the portable intermediate representation bytecode from the intermediate representation bytecode area of ​​the archive file and performs integrity verification on the archive file. Obtain the import function from the host interface specification description area of ​​the archive file; The host instantiates the portable intermediate representation bytecode and injects the import function into the instantiated portable intermediate representation bytecode. The execution of the portable intermediate representation bytecode is initiated through the host, so as to run the portable intermediate representation bytecode through the host.

[0014] According to the self-contained electronic archive processing method provided by the present invention, the step of reading the content data and the static resource set, and parsing and rendering the content data based on the portable intermediate representation bytecode and in conjunction with the static resource set, includes: During the execution of the portable intermediate representation bytecode, the resource reading function in the import function is called to read the content data and the static resource set from the partition corresponding to the archive file into the linear memory provided by the host. The content data is parsed in the linear memory, and the page rendering result is generated by combining the static resource set through layout calculation; The pixel writing function in the import function is called to output the page rendering result to the frame buffer provided by the host, so as to map the page rendering result to the display device for display.

[0015] According to the self-contained electronic archive processing method provided by the present invention, the step of performing integrity verification on the archived file includes: Extract the partition hash chain and the digital signature from the metadata and signature area of ​​the archived file; The authenticity of the archive file's origin is verified based on the digital signature, and the integrity of the archive file is determined by hashing the portable intermediate representation bytecode, the content data, and the static resource set stored in the intermediate representation bytecode area, the content area, and the resource area, respectively, based on the partition hash chain.

[0016] According to the self-contained electronic archive processing method provided by the present invention, under the condition that the host is unavailable, the method further includes: Based on the partition structure in the archive file, locate the content area and extract the serialized content data from the content area; Obtain the pattern definition embedded in the content data, and parse the content data node by node according to the pattern definition to restore the self-describing abstract syntax tree; The electronic archive is restored by traversing the self-describing abstract syntax tree, extracting the content of text nodes, recombining them, and outputting the results.

[0017] The present invention also provides an electronic archive self-contained processing device, disposed in an archive generation device, the device comprising: The extraction module is used to acquire electronic archives and extract the document logical structure and static resource set from the electronic archives; A serialization module is used to serialize the document logical structure into content data; The compilation module is used to compile the parsing and rendering logic for the content data into portable intermediate representation bytecode; The encapsulation and sending module is used to encapsulate the portable intermediate representation bytecode, the content data, and the static resource set into an archive file, and send the archive file to the parsing terminal, so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

[0018] The present invention also provides an electronic archive self-contained processing device, disposed in a parsing terminal, the device comprising: The file acquisition module is used to acquire archived files, which include portable intermediate representation bytecode, content data, and a set of static resources. A host loading module is used to load a host for running the portable intermediate representation bytecode, and to run the portable intermediate representation bytecode through the host to read the content data and the static resource set; The parsing and rendering module is used to parse and render the content data based on the portable intermediate representation bytecode and the static resource set, so as to output the restored electronic archive.

[0019] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the electronic file self-contained processing method as described above.

[0020] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the electronic archive self-contained processing method as described above.

[0021] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the electronic archive self-contained processing method as described above.

[0022] The electronic archive self-contained processing method, apparatus, and electronic device provided by this invention serialize the document logical structure of electronic archives into content data, compile the parsing and rendering logic for this content data into portable intermediate representation bytecode, and then encapsulate the portable intermediate representation bytecode, content data, and static resource set into an archive file, so that the archive file itself carries complete parsing and rendering logic. Therefore, the parsing terminal does not need to rely on any specific format external decoder or third-party parsing tools to parse and render the content data based on the bytecode and static resource set embedded in the archive file, thus restoring the electronic archive. Because the portable intermediate representation bytecode is platform-independent, the archive file can be consistently restored in incompatible hardware architectures or operating system environments, eliminating the dependence on the continuous availability of external conversion toolchains and the reproducibility of historical software and hardware environments. This reduces the risk of archives becoming unreadable due to software ecosystem changes or hardware transitions during long-term preservation, significantly improving the autonomous readability and long-term preservation stability of electronic archives. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0024] Figure 1 This is one of the flowcharts of the self-contained electronic archive processing method provided by the present invention.

[0025] Figure 2 This is a schematic diagram of the various data partitions of the archive file provided by the present invention.

[0026] Figure 3 This is the second flowchart of the self-contained electronic archive processing method provided by the present invention.

[0027] Figure 4 This is a schematic diagram of the processing flow of the archiving unit generation stage provided by the present invention.

[0028] Figure 5 This is a schematic diagram of the file parsing stage processing flow provided by the present invention.

[0029] Figure 6 This is one of the structural schematic diagrams of the electronic archive self-contained processing device provided by the present invention.

[0030] Figure 7 This is the second schematic diagram of the structure of the self-contained electronic archive processing device provided by the present invention.

[0031] Figure 8 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0033] The long-term preservation of electronic records is a fundamental challenge facing the field of archival management in the digital age. Over a preservation period of decades or even centuries, computer hardware architecture (such as instruction set architecture and storage media interfaces), operating system platforms (such as system kernel versions and driver models), and application software ecosystems (such as document editor version updates and plugin compatibility) inevitably undergo iteration, obsolescence, and even complete disruption. Within this timescale, ensuring that electronic record content remains readable and understandable in future heterogeneous environments is a core issue in the design of long-term preservation systems.

[0034] Currently, the industry is mainly focusing on three technical approaches in its implementation.

[0035] The first approach is a format migration solution. This solution periodically scans the file formats in the archive. When a format is identified as being at risk of being phased out by the mainstream ecosystem, it automatically triggers a batch conversion task, converting the archives from the old format to a new, widely supported format. To ensure the standardization of the conversion process, it is usually necessary to establish a format feature library and a set of conversion rules, and rely on a specific conversion toolchain (such as a format conversion library or command-line tools) to complete the actual data recoding.

[0036] The second approach is emulation / virtualization. This approach does not alter the original file format but preserves the complete software runtime environment required to generate the file, including specific versions of the operating system, applications, runtime libraries, and system configuration parameters. When the file needs to be opened, the target system loads a virtual machine instance, restores the historical hardware and software environment within the virtual machine, and then runs the original application in a native manner to display the file content. This approach attempts to maintain the original appearance of the file through environment cloning.

[0037] The third approach is a standardized encapsulation scheme. This scheme follows the OAIS (Open Archives Information System) reference model, packaging the archive's bitstream data, descriptive metadata, and structural documentation into a single data packet according to established specifications (such as BagIt or XFDU package formats). The encapsulated data packet itself is a standardized container, but the specific parsing method for its internal format is not included within the packet. Instead, it is saved separately as external documents (such as structural specifications and format manuals) for future reference when developing parsing programs.

[0038] While the three methods described above may have some practicality in the short or medium term, they all share a common structural flaw from a long-term preservation perspective—external decoding dependency. External decoding dependency refers to the requirement that the restoration of archival content depends on external entities independent of the archived files. These entities include specific versions of conversion tools, complete historical operating system images, manually written parsing code, or structural documentation that relies on human reading comprehension. Once these external entities become unavailable or difficult to reconstruct due to technological advancements, discontinuation of maintenance, intellectual property restrictions, or loss of talent, the readability of the archival content faces a serious threat.

[0039] Specifically, the vulnerability of format migration solutions lies in the continued availability of their conversion toolchains. Conversion tools are products of specific technological ecosystems; when that ecosystem disappears, the tools cannot run on new platforms. Even if the executable files are retained, they may fail due to missing dependencies or incompatibility with new hardware instruction sets. Simulation solutions shift the dependency to the reconstruction of the historical software stack. This requires the target environment to not only run a specific version of the virtual machine monitor but also to fully reproduce the old operating system and all its runtime dependencies. Maintenance costs increase dramatically with the length of the archive, and some older software versions may no longer be available due to copyright or technical reasons. While standardized packaging solutions ensure the standardized storage of data bitstreams and metadata, the structural documentation itself lacks executable capabilities. Future interpretation requires manual rewriting of parsing programs based on the documentation, and the semantics of the documentation may lead to inconsistent reconstruction results due to ambiguity or missing details. More importantly, when the fundamental paradigm of the future computing environment changes (e.g., from keyboard / mouse interaction to other interaction methods), the documentation at the human understanding level may no longer be directly operable.

[0040] Therefore, the fundamental flaw of the aforementioned existing technologies lies in the fact that archived files are merely passively stored data containers, lacking the ability to autonomously parse and present data. The content data and decoding logic of the archives are stored separately on different media; the former is preserved with the archives, while the latter remains in the ever-changing external technological ecosystem. This separation makes the future readability of the archives highly dependent on uncontrollable external factors, thus constituting a technological bottleneck characterized by low reliability, high maintenance costs, and unpredictable risks in the long-term preservation of electronic archives.

[0041] To address the shortcomings of existing technologies, such as the lack of autonomous parsing capabilities in archived files and the high dependence of content restoration on external environments, this invention provides a self-contained electronic archive processing method. Its core design principle is to eliminate the reliance on external tools or environments for decoding logic. Instead, the parsing and rendering logic for archive content data is compiled into platform-independent, portable intermediate representation bytecode, and this bytecode, along with the archive content data and static resource set, is encapsulated within the same archive file. The resulting archive file can autonomously restore and render its content in the target environment using only a general-purpose bytecode runtime host, without relying on any specific format external decoder or historical operating system image. The specific embodiments of this application are described in detail below with reference to the accompanying drawings.

[0042] Before describing the technical solutions of the embodiments of the present invention, the terms and concepts involved in the embodiments of the present invention will be explained illustratively.

[0043] Archive generation device: A device that performs archive file generation operations. It is used to acquire electronic archives to be archived, extract the document logical structure and static resource set from them, serialize the document logical structure into content data, compile the parsing and rendering logic into portable intermediate representation bytecode, and encapsulate the above data into archive files.

[0044] Parsing terminal: A device that performs parsing and restoration operations on archived files. It is used to obtain archived files, load and run a host environment of portable intermediate representation bytecode, and read content data and static resource sets by running the bytecode, and then perform parsing and rendering to restore electronic archives.

[0045] Electronic archives: Electronic documents to be archived and saved, including but not limited to structured or semi-structured text processing documents, layout documents, markup language documents, static images and tabular documents, the content of which may include text, images, tables, multimedia and other elements.

[0046] Document logical structure: Data that abstractly represents the way the content of an electronic archive is organized. It is usually presented in a tree structure and is used to describe various semantic nodes in the document (such as titles, paragraphs, tables, lists, image references, etc.) and their hierarchical relationships and order.

[0047] Static resource collection: A collection of binary data objects embedded in electronic archives that are relatively independent of the main content of the document, including but not limited to image data (such as JPEG, PNG), font subsets, multimedia objects, etc. Each resource is assigned a unique resource identifier within the archive file for indexing.

[0048] Portable intermediate representation bytecode: A platform-independent sequence of low-level instructions compiled from the parsing and rendering logic of content data. It adopts a linear memory model and structured control flow, conforms to standardized intermediate representation specifications (such as WebAssembly 1.0), and can be loaded and executed on any platform that implements the corresponding runtime host.

[0049] Content data: The linear byte sequence obtained after serializing the document's logical structure is one of the main data in the archive file, which is used by the portable intermediate representation bytecode module to parse and restore the original document logical structure.

[0050] Archive file: A binary file that encapsulates portable intermediate representation bytecode, content data, static resource set and other auxiliary information (such as interface specifications, metadata, verification data) according to a predetermined partition structure, and serves as a long-term storage unit for electronic archives.

[0051] Parser Execution Program: A source code program written to meet the needs of parsing and rendering content data. Its functions include AST traversal, page layout calculation, resource decoding (such as image decompression and font rasterization), and pixel output. This program is compiled into portable intermediate representation bytecode during the compilation stage.

[0052] Self-Descriptive Abstract Syntax Tree (SDS): A tree-like data structure that semantically abstracts the logical structure of a document. Each node is labeled with a clear semantic type (such as document, chapter, paragraph, table, image reference, etc.), and the tree contains embedded schema definitions that define node attributes and child node constraints, allowing the tree to be parsed and traversed independently without an external schema file.

[0053] Intermediate representation bytecode area: A separate partition in the archive file used to store portable intermediate representation bytecode modules and their hash check values.

[0054] Content area: A separate partition within an archive file used to store serialized content data.

[0055] Resource area: A separate partition in the archive file used to store static resource data blocks indexed by resource ID.

[0056] Host Interface Specification Description Area: A separate section in the archive file used to record the interaction contract between the portable intermediate representation bytecode and the external host environment, including the signature definition of imported functions (function name, parameter types, return value types) to limit the bytecode's access permissions to the host environment.

[0057] Import function signature: The function interface specification defined in the host interface specification description area, including function name, parameter type and return value type, is used to limit the scope of external functions that the portable intermediate representation bytecode can call, such as pixel writing function, resource reading function, error reporting function, memory request function, etc.

[0058] Partition hash chain: A verification mechanism that calculates hash values ​​sequentially based on the data of each partition in an archive file and stores the results in a chain structure. It is used to verify the integrity of the data in each partition before parsing. Any change in the data of any partition will cause the hash chain verification to fail.

[0059] Imported functions: These are specific functions implemented by the host environment and injected into the portable intermediate representation bytecode instance. They correspond to the import function signatures defined in the host interface specification description area. During runtime, the bytecode module interacts with the host through these functions to complete operations such as resource reading, pixel output, error reporting, and memory allocation.

[0060] To better understand the technical solutions of the embodiments of the present invention, the execution subject of the above method is illustrated below.

[0061] The execution entities involved in this invention mainly include two types: archiving generation devices and parsing terminals. These two devices cooperate functionally to jointly generate and restore self-contained archival files for electronic records. The archiving generation device is responsible for constructing and packaging the archival files and is typically deployed in the processing systems of archival management departments or professional archival service organizations. The parsing terminal is responsible for receiving and restoring the archival files and can be deployed in any target environment where electronic records need to be accessed or used. Data is transferred between the two devices through the archival files.

[0062] The archiving generation device functionally undertakes operations such as parsing source electronic archives, serializing content data, compiling parsing and rendering logic, and assembling archive files. After acquiring the electronic document to be archived, the device extracts the document's logical structure and static resource set, serializes the document's logical structure into content data, compiles the parsing and rendering logic for this content data into portable intermediate representation bytecode, and finally encapsulates the above data into archive files according to a partitioned structure.

[0063] The parsing terminal is responsible for receiving and restoring archived files. It loads a host environment that runs portable intermediate representation bytecode. The host runs the bytecode to read content data and static resource sets, and based on the bytecode and static resources, it completes the parsing and rendering of the content data, outputting the restored electronic archive. When the host environment is unavailable, the parsing terminal can also degrade to directly extracting serialized data and its embedded mode definitions from the content area, achieving structured restoration at the text level by traversing the self-describing abstract syntax tree.

[0064] It should be noted that the division between the archiving generation device and the parsing terminal is based on logical function. The same physical device can assume one or two roles in different stages or application scenarios, and this invention does not limit this.

[0065] Figure 1 This is a flowchart illustrating the self-contained electronic archive processing method provided in an embodiment of the present invention. The method includes: Step 101: Obtain the electronic archive and extract the document logical structure and static resource set from the electronic archive.

[0066] In step 101, the archiving generation device first acquires the electronic archive to be archived. This electronic archive can be in various structured or semi-structured document formats, such as word processing documents, layout documents, or markup language documents. The acquisition method can be reading from a storage medium, acquiring from a data receiving interface, or importing from a user-specified path.

[0067] The archiving generation device parses electronic archives by calling a parser or format conversion component corresponding to the source document format, extracting the document's logical structure and static resource set. The document's logical structure is an abstract representation of how the electronic archive's content is organized, typically presented as a tree structure. It describes the type and hierarchical relationship of each semantic unit in the document, specifically including type labels for semantic nodes such as titles, paragraphs, tables, lists, image references, and chapter divisions, as well as their nesting and sequential relationships. The static resource set refers to binary data objects embedded in the electronic archive that are relatively independent of the document's main content and cannot be directly expressed by text description. These include, but are not limited to, embedded image data, subsets of font data used in the document, and multimedia objects. When extracting these resources, the parser assigns a unique resource identifier to each resource and saves them as independent data blocks for later inclusion in the archive's resource area during encapsulation.

[0068] After the above analysis and extraction operations, the electronic file is broken down into two parts: a logical structure description and independent resource data, providing standardized input for subsequent serialization and encapsulation processing.

[0069] Step 102: Serialize the document logical structure into content data.

[0070] The archiving generation device serializes the document logical structure extracted in step 101 into content data. Since the document logical structure typically exists in memory as a tree or graph-like data structure, it cannot be directly stored linearly in a file. Therefore, it needs to be converted into a continuous byte sequence, i.e., serialization. The purpose of serialization is to transform the logical structure containing various semantic nodes and their hierarchical relationships into a compact, standardized data representation independent of the original editing format, facilitating storage in the archive file and transmission and retrieval at the parsing terminal. During serialization, the semantic type, attribute fields, parent-child relationships, and order of each node in the document logical structure are completely preserved in the serialized byte stream, ensuring that the subsequent parsing process can accurately reconstruct the original document logical skeleton from the content data.

[0071] The serialized content data will be used as an independent component in the archive file for subsequent bytecode modules to read and process during parsing and rendering. Its specific format can be a key-value pair structure, markup language encoding, or binary encoding, as long as the serialization result can be correctly restored by the corresponding parsing logic.

[0072] Step 103: Compile the parsing and rendering logic for the content data into portable intermediate representation bytecode.

[0073] The archiving generation device first acquires or writes a parser execution program, which contains complete content data processing logic: it can read the serialized content data generated in step 102 and restore the document logical structure; it can decode various resources in the static resource set; and it can calculate the page layout and generate the final rendered pixel output based on the restored logical structure and decoded resource data. This parser execution program is designed as a platform-independent algorithm implementation, and its dependence on the external environment is limited to basic memory operations and a few explicitly defined external function calls. Subsequently, the archiving generation device processes the source code of this parser execution program through a compiler front-end, compiling it into a portable intermediate representation bytecode module conforming to the standardized intermediate representation specification. This bytecode module adopts a linear memory model and structured control flow, is independent of the underlying characteristics of any specific operating system or hardware architecture, and its instruction semantics are uniformly defined by the standardized specification. Therefore, it can be loaded and executed on any platform that implements the corresponding runtime host. The compiled portable intermediate representation bytecode exists in the form of a binary instruction sequence. Its decoding and execution only require a compatible bytecode runtime host, without the need to recompile the source code for the target platform or adapt it to different system environments.

[0074] Furthermore, during the compilation process, decoding algorithms for specific content formats that may be contained in the file are statically linked into the parser and compiled into bytecode. These decoding algorithms include, but are not limited to, image decompression algorithms, font mathematical operations and glyph rasterization algorithms, and structured document parsing algorithms. This enables the final bytecode module to have complete self-contained decoding capabilities during execution, without relying on any specific format decoders pre-installed in the target environment.

[0075] Step 104: Encapsulate the portable intermediate representation bytecode, the content data, and the static resource set into an archive file, and send the archive file to the parsing terminal so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

[0076] Encapsulation means integrating the aforementioned components into a unified binary file according to a predetermined organizational structure, facilitating transmission, storage, and long-term preservation. Portable intermediate representation bytecode serves as the carrier of parsing and rendering logic, content data serves as a serialized representation of the document structure, and static resource sets serve as the auxiliary data source required for rendering; these three elements together constitute the main payload of the archive file. During the encapsulation process, each component is stored separately in different partitions of the archive file, supplemented by file headers, partition indexes, and other management information to support the parsing terminal in quickly locating and retrieving the required data during restoration.

[0077] After encapsulation, the archiving generation device sends the archive file to the parsing terminal via network transmission, storage medium transfer, or data stream push. Upon receiving the archive file, the parsing terminal can independently parse and render the content data based on the portable intermediate representation bytecode and static resource set carried within it, thereby restoring the original electronic archive. The entire parsing and restoration process does not rely on the archiving generation device, external conversion toolchain, or any third-party decoding library.

[0078] In this embodiment, by compiling the parsing and rendering logic for content data into portable intermediate representation bytecode, and encapsulating this bytecode along with the content data and static resource set in the same archive file, the archive file itself carries complete parsing and rendering capabilities. Since the portable intermediate representation bytecode is a platform-independent standardized instruction sequence, its execution does not depend on a specific operating system or hardware architecture. Therefore, the archive file can be consistently restored in various heterogeneous target environments, fundamentally eliminating dependence on external decoding toolchains or third-party parsing software for specific formats, and avoiding the risk of archives becoming unreadable due to the demise of historical operating systems or application software ecosystems. Simultaneously, since the parsing and rendering logic is stored in the same archive file as the content data in bytecode form, there is no need to maintain external conversion tools or format feature libraries during long-term preservation. Archive management departments also do not need to maintain separate parsing environments for different format types, thereby reducing operational complexity and significantly improving the autonomous readability and long-term preservation stability of electronic archives in future heterogeneous environments.

[0079] Furthermore, in this embodiment, during the serialization of the document's logical structure into content data, the archiving generation device constructs the extracted document logical structure into a self-describing abstract syntax tree. Each node in this abstract syntax tree is labeled with a clear semantic type, including but not limited to document root nodes, chapter nodes, paragraph nodes, text fragment nodes, table nodes, table row nodes, table cell nodes, and image reference nodes. These semantic types accurately express the document's logical structure rather than visual rendering attributes, making the abstract syntax tree a purely semantic representation of the document's content organization method. This avoids binding to specific layout styles or presentation formats, thereby enhancing the stability and universality of the document structure description. In addition to labeling the semantic type, each node also records its attribute fields and the parent-child relationships and order with other nodes, completely preserving the document's logical skeleton.

[0080] The archiving device embeds a schema definition within a self-describing abstract syntax tree (ASLT) to define node attributes and serializes the ASLT after embedding the schema definition to generate content data. The schema definition describes an enumeration of all possible node types in the ASLT, the allowed attribute fields and their data types for each type, and the child node constraint rules between nodes of different types. This schema definition is serialized in the header of the ASLT data in normalized text form (such as a key-value pair structure or an S-expression), starting with a fixed identifier and separated by length prefixes. This allows the parser to first obtain the schema definition when reading the content data and then interpret the subsequent tree node data item by item based on this definition. The embedding of this schema definition enables the content data to be completely self-describing—that is, the data itself carries all the type information needed to understand its own structure. Any general-purpose tool that follows basic data parsing specifications can traverse and interpret the content data based on this schema definition, without relying on external schema files, pre-agreed format specifications, or manually written specific parsing code. The normalized representation generated after the above serialization process is the content area data of the archive file. It contains both the schema definition used to guide parsing and the abstract syntax tree entity that carries the logical structure of the document, providing a data foundation for the downgraded parsing path.

[0081] Through a self-describing abstract syntax tree with an embedded schema definition, the content data obtains a degraded parsing channel independent of the bytecode execution path. When the target environment cannot provide a bytecode runtime host, the parsing terminal can directly parse the abstract syntax tree based on the schema definition carried in the content data, extract the document's text content and logical structure, and reconstruct and output it, avoiding the complete unreadable archive information. Since the schema definition and the abstract syntax tree data are bound and stored in the same content data, parsing does not rely on any external specification files or manually predefined format specifications, eliminating the problem of inconsistent structure reconstruction caused by lost format specifications or semantic interpretation deviations. At the same time, the abstract syntax tree only carries logical structure rather than visual rendering attributes, so that the structured text output by the degraded parsing is not constrained by specific typesetting styles, ensuring the accessibility of information in different terminal environments.

[0082] In one optional implementation of step 103, during the compilation of the parsing and rendering logic into portable intermediate representation bytecode, the archiving generation device first acquires or writes a parsing executable program, which implements complete parsing and rendering functions for the content data. During the compilation phase, the archiving generation device statically links decoding algorithms for specific content formats that may be contained in the content data to the parsing executable program. These decoding algorithms cover the processing logic required for various specific format data in the content data, including but not limited to image decompression algorithms (for decoding embedded images in formats such as PNG and JPEG), font mathematical operations and glyph rasterization algorithms (for converting character encoding into renderable glyph pixels), and structured document parsing algorithms (for interpreting text content in specific markup formats). Static linking means that the implementation code of these decoding algorithms is directly incorporated into the target instruction stream of the parsing executable program during compilation, rather than being stored outside the archive file as a dynamic link library, external plugin, or independent executable file. Static linking ensures that all decoding logic becomes an integral part of the parsing executable program after compilation and will not fail to function due to the target environment lacking specific versions of dynamic libraries or external tools.

[0083] After static linking, the archive generation device processes the entire source code of the parser / executable program via a compiler front-end, compiling it into a portable intermediate representation bytecode module conforming to the standardized intermediate representation specification. Through this compilation process, the parser / executable program, which originally depended on specific programming language features and compilation platform toolchains, is transformed into a fixed sequence of instructions independent of specific hardware architecture and operating system. During this process, all statically linked decoding algorithms also exist in the final bytecode module as portable intermediate representation bytecode instructions, bound to the content data and stored within the same archive file.

[0084] In this way, the archive file acquires complete self-contained decoding capabilities. The target environment only needs to provide a compliant, portable intermediate representation bytecode runtime host to execute the bytecode module. The module itself completes all conversion work within the linear memory provided by the host, from structural parsing of content data and format decoding of static resources to final rendering pixel output. The host itself does not need to install any specific format decoders. Because the decoding logic is bound to the content data and stored in the same archive file, and is saved synchronously with the archive content, even if the relevant format decoding specifications are no longer supported by mainstream operating systems or application software in the future, the decoding algorithm implementation stored in this bytecode module can still be executed normally, thus eliminating the dependence of archive readability on external decoding toolchains.

[0085] In one optional implementation of step 104, the archive generation device assembles the aforementioned components into a unified binary archive file according to a predetermined partitioning structure. This archive file begins with a header section containing a file magic number identifying that the file conforms to the archive unit format defined in this application; a version number identifying the format version of the archive unit to support subsequent format evolution and compatibility expansion; and a partition index offset indicating the starting position of the partition index table in the file. This allows the parsing terminal to quickly locate the partition index table through the file header when reading the archive file, thereby obtaining the type identifier, starting offset, and length information of each partition, enabling random access to any partition. Following the file header, the individual data partitions are arranged sequentially according to the partitioning structure.

[0086] Figure 2 This shows the data partitions of the archive file, arranged sequentially from the file header. Figure 2 As can be seen, the partitioning structure includes at least three main partitions: the intermediate representation bytecode area, the content area, and the resource area. The intermediate representation bytecode area stores the portable intermediate representation bytecode module generated in step 103 and its hash checksum. This area stores the executable instruction sequence, which integrates decoding algorithms for content formats such as images and fonts, and is the core of the archiving unit's autonomous parsing capability. The content area stores the content data generated by serialization in step 102, i.e., the serialized byte stream of the self-describing abstract syntax tree and its embedded pattern definition. This area stores the logical structure information of the document and is the main content of the archiving unit. The resource area stores the extracted static resource set. Each resource is indexed by resource ID and arranged in the form of independent data blocks. Each resource block records its length and original data. Typical content includes, but is not limited to, font subset data, embedded static image data, and multimedia objects. When the bytecode module performs rendering, it can read the required resource data from this area according to the resource ID, offset, and length, and store it in linear memory.

[0087] In addition to the three main partitions mentioned above, archived files may also include a host interface specification description area, a schema definition area, and a metadata and signature area. The host interface specification description area records the interaction contract between the portable intermediate representation bytecode and the external host environment, i.e., the import function signature definition, including the name, parameter types, and return value types of each imported function. By explicitly defining the interface specification in this area, the bytecode module can know the scope of external functions it can call before execution, and the bytecode's access permissions to the host are limited to the functions defined in the signature, thus constraining the execution boundary of the bytecode. The schema definition area stores the schema definitions of node types in the self-describing abstract syntax tree, including AST node type enumerations (such as DOCUMENT, SECTION, PARAGRAPH, TEXT_RUN, TABLE, TABLE_ROW, TABLE_CELL, IMAGE_REF, etc.) and field constraint definitions for each node type. This area is stored in UTF-8 text format, allowing the parsing terminal to directly read and understand the document structure rules without loading the bytecode module. The metadata and signature area is used to store archive identifiers, timestamps, partition hash chains, and digital signatures. The partition hash chain is a verification mechanism that calculates the hash value of each partition's data in sequence and stores the results in a chain structure. The digital signature is used to verify the authenticity of the archive's source. This area provides the data foundation for verifying the integrity of archives and authenticating their source credibility.

[0088] Through the aforementioned partitioning structure, the components are physically isolated but logically interconnected. The bytecode area, content area, and resource area respectively carry the parsing execution logic, the content data to be parsed, and the static resources to be rendered. This allows the parsing terminal to independently access each partition during the restoration process, which is beneficial for on-demand loading and facilitates integrity verification of each partition separately. The resulting binary file after encapsulation is the archive unit, which can be permanently stored in storage media or transmitted to the parsing terminal via a network.

[0089] In one alternative implementation of step 104, before assembling and generating archive files according to the partition structure, the archive generation device first defines import function signatures in the host interface specification description area to restrict the access permissions of the portable intermediate representation bytecode to the host environment.

[0090] Specifically, the archiving device writes the import function signature definition into the host interface specification description area. This signature defines the name, parameter type, and return value type of the external functions that the portable intermediate representation bytecode can call at runtime. The import function signature includes at least one of the following: a pixel write function for writing RGBA pixel data of a specified area to the frame buffer provided by the host; a resource read function for reading data from the resource and content areas of the archive file in blocks according to resource ID, offset, and length; an error reporting function for reporting runtime error information to the host; and a memory request function for requesting extended linear memory pages for the portable intermediate representation bytecode. The implementations of these import functions are provided by the host environment of the parsing terminal when loading the bytecode module. The bytecode module can only interact with the outside world through the functions defined in the signature and cannot call any system interfaces outside the signature. During execution, the bytecode module obtains content data and static resources through the resource read function, completes structural parsing, image decoding, and page layout calculation in linear memory, and outputs the rendering results to the host's frame buffer through the pixel write function. During this process, it satisfies dynamic memory requirements through the memory request function and records runtime exceptions through the error reporting function.

[0091] In this way, the host only performs basic I / O services and memory management in the file parsing process, without participating in any format semantic understanding or the execution of specific decoding algorithms. The interface specification is completely independent of the file content type, so adding new file types requires no modification to the host. At the same time, importing function signatures restricts the bytecode module's access to the external environment to a clearly defined interface scope, only exposing in-package resource reading and pixel output channels, without exposing network access, file system traversal, or external process call capabilities. This maintains the lightweight nature of the host implementation while mechanically limiting the potential attack surface of malicious bytecode.

[0092] Furthermore, during the archive generation process, the archive generation device calculates hash values ​​for each partition based on the partition structure and stores these hash values ​​in a chained structure, generating a partition hash chain. Each hash value in this partition hash chain corresponds to the data content of an independent partition (such as the bytecode area, content area, resource area, host interface specification description area, schema definition area, etc.). Any change in the data of any partition will cause a change in the corresponding hash value, thereby compromising the consistency of the entire hash chain. Simultaneously, the archive generation device also uses an asymmetric encryption algorithm to calculate a digital signature for the entire archive file or its key header information to authenticate the source of the archive file. The aforementioned partition hash chain and digital signature, along with archive identifiers, timestamps, and other information, are stored in the metadata and signature area.

[0093] Through the above methods, the partitioned hash chain provides an independent integrity verification basis for each partition of the archived file. This allows the parsing terminal to verify the integrity of the data in each partition without having to parse the entire archived file, and to promptly detect any data corruption that may occur during transmission or storage. Digital signatures provide authentication of the source, ensuring that the archived file indeed originates from a trusted archiving device and that its critical information has not been tampered with. This provides technical assurance for the credibility of electronic archives as legal documents and historical evidence, meeting the dual requirements of authenticity and integrity for long-term archival preservation while ensuring self-contained readability.

[0094] This invention also discloses a self-contained electronic archive processing method, see [link to relevant documentation]. Figure 3 The method, executed by the parsing terminal, includes: 301. Obtain the archive file, which includes portable intermediate representation bytecode, content data, and a set of static resources.

[0095] The parsing terminal retrieves the archive file to be restored. This archive file includes at least portable intermediate representation bytecode, content data, and a set of static resources. The retrieval method can be to read a pre-saved archive file from a local storage device, receive an archive file transmitted over a network from an archive generation device or archive management server, or allow the user to manually specify the path to the archive file to be restored through a file selection interface, which the parsing terminal then imports.

[0096] As an independent carrier of all the information content and parsing logic of the electronic archive, the archive file is the only input source for the parsing terminal to perform subsequent restoration operations. The parsing terminal can complete the archive restoration based on the data carried by the archive file itself without needing to obtain any external decoding tools, format specification documents or historical software environment information.

[0097] 302. Load a host for running the portable intermediate representation bytecode, run the portable intermediate representation bytecode through the host to read the content data and the static resource set, and parse and render the content data based on the portable intermediate representation bytecode and the static resource set to output the restored electronic archive.

[0098] The parsing terminal first invokes or starts a runtime host capable of executing portable intermediate representation bytecode. This host is the execution container for the bytecode, responsible for loading bytecode modules, managing linear memory, and driving the execution of the bytecode. The host extracts the portable intermediate representation bytecode module carried in the archive file and loads it into memory, instantiates it, establishes an independent runtime sandbox and linear memory space for the bytecode, and injects the necessary host interaction capabilities.

[0099] Subsequently, the parsing terminal initiates the execution of the bytecode module through the host, and the bytecode module independently controls the entire parsing and rendering process. During operation, the bytecode module uses the resource reading capabilities provided by the host to obtain content data and static resource sets from the archive file and loads them into the linear memory provided by the host. In the linear memory, the bytecode module independently performs structural parsing of the content data to reconstruct the logical skeleton of the document, decodes the binary data such as images and fonts in the static resource set to prepare rendering materials, and performs page layout calculations and rendering based on the parsed document structure and decoded resource data, ultimately generating complete page pixel buffer data.

[0100] After generating the rendering result, the bytecode module transmits the page pixel data to the host environment using the pixel output capabilities provided by the host. Upon receiving the rendering result, the host maps it to a display device for screen presentation, or exports it to other visual output formats according to user instructions, thus completing the full restoration of the electronic file. Throughout the entire parsing and rendering process, all operations involving format semantic understanding, structural parsing algorithms, decoding logic, and rendering calculations are performed autonomously by the bytecode module. The host environment of the parsing terminal only acts as a general execution container and basic service provider, without participating in the processing of any file format-specific logic or the execution of specific decoding algorithms.

[0101] In one optional implementation of step 302, the parsing terminal extracts the portable intermediate representation bytecode module from the intermediate representation bytecode area of ​​the archive file through the host, and performs integrity verification on the archive file before loading.

[0102] It should be noted that, in the embodiments of the present invention, the host refers to the runtime environment that runs on the parsing terminal and is used to load and execute portable intermediate representation bytecode. It is the basic software component in the parsing terminal responsible for bytecode execution. The parsing terminal, as the main device for executing the method, completes the loading, verification, instantiation and execution of the bytecode module through the host environment on it.

[0103] Specifically, the process by which the parsing terminal performs integrity verification on archived files is as follows: The parsing terminal extracts the partition hash chain and digital signature from the metadata and signature area of ​​the archived file through the host. The partition hash chain is verification data that calculates the hash value of the data content of each independent partition of the archived file (at least including the intermediate bytecode area, content area, and resource area) and stores them in a chain structure. The digital signature is the signature data generated by the archive generation device using an asymmetric encryption algorithm on the entire archived file or key header information.

[0104] The host first verifies the authenticity of the archive file's origin based on a digital signature. This involves using a pre-defined public key or certificate to verify the digital signature, confirming that the archive file indeed originates from a trusted archiving device and that its critical information has not been maliciously altered during transmission or storage. If the digital signature verification fails, the host determines that the archive file's origin is untrustworthy and refuses to execute subsequent loading and parsing processes. After successful digital signature verification, the host performs hash verification on the portable intermediate representation bytecode, content data, and static resource sets stored in the intermediate representation bytecode area, content area, and resource area, respectively, based on the partition hash chain. The host recalculates the hash value of the data stored in each partition and compares the result with the corresponding hash value recorded in the partition hash chain. If the current hash value of any partition does not match the recorded value, it indicates that the data in that partition has been corrupted or altered after the archive file was generated. The host determines that the archive file's integrity is compromised, refuses to execute subsequent parsing and rendering processes, and reports an error. Only when the hash verification of all partitions matches the partition hash chain records does the host confirm the integrity of the archive file and allow the bytecode loading and subsequent archive restoration processes to continue.

[0105] Then, the parsing terminal obtains the import function signature definitions from the host interface specification description area of ​​the archive file through the host, clarifying the names, parameter types, and return value types of the external functions that the bytecode module can call. Based on these signature definitions, the host implements the corresponding import functions in its own environment, including but not limited to pixel write functions, resource read functions, error reporting functions, and memory request functions.

[0106] After preparing the import functions, the parsing terminal instantiates the verified portable intermediate representation bytecode module through the host, allocates an independent linear memory space for it, and injects the implemented import functions into the instantiated bytecode module. After instantiation and injection are complete, the host starts the execution of the portable intermediate representation bytecode, calls the entry function of the bytecode module, and drives the complete parsing and rendering process.

[0107] Through the above methods, the host performs pre-verification of the integrity and authenticity of the archived files using partition hash chains and digital signatures before loading the bytecode module. This ensures that the data upon which the parsing process is based is complete and reliable, providing a fundamental guarantee for the authenticity of the archive restoration results. Simultaneously, the import function acquisition and injection mechanism ensures that the interaction between the host and the bytecode module strictly adheres to the predefined interface contract in the archived file. The host only needs to provide basic services limited by signatures and does not participate in format semantic understanding, guaranteeing the lightweight and universality of the host implementation. Archived files from different sources and of different types can be loaded and executed by the same host environment without specific adaptation.

[0108] Furthermore, in one alternative implementation, the specific process of the portable intermediate representation bytecode execution and parsing / rendering is as follows: After the host initiates the execution of the portable intermediate representation bytecode, the bytecode module first calls the resource read function injected by the host during runtime to read the required data from the partition corresponding to the archive file into the linear memory provided by the host. Specifically, the bytecode module reads the serialized AST content data from the content area through the resource read function, and reads various types of resource data (such as image encoding data, font subset data, etc.) from the static resource set in the resource area according to resource ID into the corresponding areas of the linear memory. The linear memory is an independent memory space allocated by the host for the bytecode module, which adopts a linear address model. The bytecode module completes all data read and write operations in this memory, which is isolated from the host physical memory and the operating system memory space.

[0109] Subsequently, the bytecode module performs complete parsing and rendering operations within the linear memory provided by the host. The bytecode module parses the content data loaded into linear memory, traversing the document's logical structure tree based on the node types and hierarchical relationships of the Abstract Syntax Tree (AST) to reconstruct the complete structural relationships of each semantic unit in the document. Simultaneously, the bytecode module performs format decoding on the static resources loaded into linear memory, including but not limited to decompressing image encoded data (such as PNG and JPEG formats) to restore the original pixel matrix, and performing glyph rasterization on font subset data to convert character encoding into renderable glyph bitmaps. After completing the structure parsing and resource decoding, the bytecode module performs page layout calculations based on the parsed document logical structure and decoded resource data, determining the position and size of each text line, paragraph, table, image, and other element on the page, and rasterizing the actual content of each element into pixel data, combining them to form a complete page rendering result. The entire calculation process is completed within the linear memory provided by the host, without any access to the host file system, network, or external processes.

[0110] Finally, the bytecode module calls the pixel write function injected by the host to output the page rendering result generated in linear memory (i.e., pixel buffer data in RGBA format) to the frame buffer provided by the host. After receiving the pixel data in the frame buffer, the host maps it to the display device for screen presentation, or exports it to other visual output formats according to user needs, thus completing the restoration of the electronic file.

[0111] In one alternative implementation, when the runtime host of the portable intermediate representation bytecode on the parsing terminal is unavailable, the parsing terminal can initiate a downgraded parsing path to recover the archive information by directly reading the structured data in the archive file.

[0112] The parsing terminal first locates the content area based on the partition structure in the archive file and extracts the serialized content data from the content area. Because the archive file is organized using a standardized partition structure, each partition records a type identifier, start offset, and length information. Therefore, even without a bytecode runtime host, the parsing terminal can still directly extract the required serialized data from the content area through general file read operations.

[0113] Subsequently, the parsing terminal obtains the schema definition embedded in the content data and performs node-by-node parsing based on this schema definition to reconstruct the self-describing abstract syntax tree. As described in step 102 above, the content data has already embedded the schema definition describing node types, attribute fields, and child node constraints in the data header during serialization. The parsing terminal reads this schema definition from the extracted content data, obtaining the node type enumeration (such as DOCUMENT, SECTION, PARAGRAPH, TEXT_RUN, TABLE, etc.) and the attribute fields and child node constraint information of each type of node. Based on this, it performs node-by-node parsing on the main body of the content data, restoring the linear byte stream into a traversable tree-like AST structure. This parsing process only needs to be completed according to basic data parsing specifications (such as reading key-value pair structures or S-expressions), without relying on any external specification files, pre-agreed format specifications, or manually written specific parsing code.

[0114] The parsing terminal extracts text node content and reassembles it into output by traversing and restoring the self-describing abstract syntax tree (AST). Specifically, the parsing terminal traverses all nodes of the AST, extracts the text content strings carried by each text node (such as the TEXT_RUN node), and restructures the extracted text according to the hierarchical relationships preserved in the AST (such as the nested structure of chapter-paragraph-text fragment), forming readable text output with logical hierarchy. For non-text nodes (such as image reference nodes and table nodes), the parsing terminal can output corresponding alternative text or structural markers based on the node attributes—for example, for image reference nodes, it can extract alternative text from their alt attribute, or extract the corresponding original image data from the resource area based on the resource ID, and directly render or display it if the current environment supports the image format; for table nodes, it can extract their row and column structure and represent them as tables in plain text or with indentation. The restructured structured text can be presented in character terminals, plain text viewers, or other display environments that do not have a bytecode runtime host.

[0115] Through the aforementioned downgraded parsing method, even if the target environment is unable to perform high-fidelity visual reconstruction due to limited hardware resources, security policy constraints, or the host not being able to access the bytecode at runtime, the parsing terminal can still recover the core text information and logical structure of the electronic archive from the archive file, avoiding the complete inaccessibility of the archive content.

[0116] The following is combined Figure 4 and Figure 5 The self-contained electronic archive processing method provided in the embodiments of the present invention will be fully described.

[0117] Figure 4 This example illustrates the processing flow during the archive unit generation phase. For example... Figure 4 As shown, in the offline processing stage, the archiving generation device first acquires the source electronic document to be archived. It then parses the source electronic document by calling a format parser corresponding to the source document's format, extracting the AST logical structure and static resources. The AST logical structure is an abstract representation of the organization of electronic archive content, describing the type and hierarchical relationship of each semantic node in the document using a tree structure; static resources include embedded images, font subsets, multimedia objects, and other binary data. Simultaneously, in the offline compilation stage, the archiving generation device acquires the pre-written parsing and rendering program source code. This program implements complete logic for traversing and parsing the AST logical structure, decoding the format of static resources, and performing page layout calculations and raster rendering. The archiving generation device processes this parsing and rendering program using an IR compiler, compiling it into a portable intermediate representation bytecode module (such as...) that conforms to the standardized intermediate representation specification. Figure 4 (reader.wasm in the illustrated embodiment). The IR compiler is a compilation tool that parses and executes the source code of an executable program into a portable intermediate representation bytecode module.

[0118] After completing the offline processing and compilation, the archive generation device uses a wrapper to assemble the AST logical structure (the serialized content data), static resources, and the reader.wasm bytecode module into a self-contained archive unit according to a predetermined partitioning structure. Once the archive unit is assembled, the archive generation device sends it to the parsing terminal or transfers it in the form of a storage medium for subsequent long-term preservation or restoration.

[0119] Figure 5 The process flow of the file parsing stage is shown, which provides two independent file restoration paths.

[0120] The first path is the primary execution path, suitable for situations where the target environment can provide a portable intermediate representation of the bytecode runtime host. For example... Figure 5 As shown, after the parsing terminal obtains the archive unit, it starts the IR runtime host, which loads the reader.wasm bytecode module in the archive unit and injects it into the host interface.

[0121] The IR runtime host is a runtime environment that runs on top of a parsing terminal and is used to load and execute portable intermediate representation bytecode. Figure 5During the file parsing phase, the IR runtime host is responsible for loading bytecode modules, performing integrity checks, retrieving and injecting import functions from the host interface specification description area, instantiating bytecode modules, managing linear memory, and driving bytecode execution. Bytecode modules interact with the external environment through import functions provided by the host (resource reading, pixel writing, error reporting, memory requests).

[0122] After the host starts executing the bytecode module, the bytecode module performs the following operations: reads AST content data and static resource data from the archive unit into the linear memory provided by the host through the resource reading function; performs decoding operations on static resources such as images in the linear memory to restore them to the original pixel data; parses the AST content data to restore the logical structure of the document; performs page layout calculations based on the parsed logical structure and the decoded resource data to determine the position and size of each element on the page; combines the content of each element into complete page pixel data through rasterization rendering; and finally calls the pixel writing function to output the rendering result to the host frame buffer, which then maps the frame buffer content to the display device to complete high-fidelity visual restoration.

[0123] The second path is a downgraded resolution path, suitable for extreme cases where the target environment cannot provide a portable intermediate representation of the bytecode runtime host. For example... Figure 5 As shown, the parsing terminal directly extracts the schema definition area and serialized AST content data from the archive unit through a general data parser. Based on the schema definition, it performs node-by-node parsing of the AST data to restore the structure of the self-describing abstract syntax tree. Then, it traverses the AST nodes to extract the text content and alternative text, and finally outputs structured text or simplified display content to achieve readability at the information level.

[0124] Through the complete process of the above generation and parsing stages, the archive unit is endowed with complete autonomous parsing capabilities at the time of generation. During parsing, high-fidelity visual restoration is achieved through the main path, and the accessibility of core information is ensured through the degradation path when the host is unavailable, thus forming a two-level archive recovery mechanism.

[0125] The following describes the electronic archive self-contained processing apparatus provided in the embodiments of the present invention. The electronic archive self-contained processing apparatus described below and the electronic archive self-contained processing method described above can be referred to in correspondence with each other.

[0126] This invention provides a self-contained electronic archive processing device, see [link to documentation]. Figure 6 The device is installed in the archiving generation equipment, and the device includes: Extraction module 610 is used to acquire electronic archives and extract the document logical structure and static resource set from the electronic archives; Serialization module 620 is used to serialize the document logical structure into content data; Compilation module 630 is used to compile the parsing and rendering logic for the content data into portable intermediate representation bytecode; The encapsulation and sending module 640 is used to encapsulate the portable intermediate representation bytecode, the content data, and the static resource set into an archive file, and send the archive file to the parsing terminal so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

[0127] This invention provides a self-contained electronic archive processing device, installed in a parsing terminal, see [link to documentation]. Figure 7 The device includes: The file acquisition module 710 is used to acquire archived files, which include portable intermediate representation bytecode, content data, and a set of static resources. The host loading module 720 is used to load a host for running the portable intermediate representation bytecode, and to run the portable intermediate representation bytecode through the host to read the content data and the static resource set; The parsing and rendering module 730 is used to parse and render the content data based on the portable intermediate representation bytecode and the static resource set, so as to output the restored electronic archive.

[0128] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a self-contained electronic file processing method.

[0129] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the electronic file self-contained processing method provided by the above methods.

[0131] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the electronic archive self-contained processing method provided by the above methods.

[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A self-contained electronic archive processing method, characterized in that, The method, performed by an archive generation device, includes: Obtain electronic archives, and extract the document logical structure and static resource set from the electronic archives; Serialize the document's logical structure into content data; The parsing and rendering logic for the content data is compiled into portable intermediate representation bytecode; The portable intermediate representation bytecode, the content data, and the static resource set are encapsulated in an archive file, and the archive file is sent to a parsing terminal so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

2. The self-contained electronic archive processing method according to claim 1, characterized in that, The step of compiling the parsing and rendering logic for the content data into portable intermediate representation bytecode includes: During the compilation phase, decoding algorithms for specific content formats in the content data are statically linked to the parsing and execution program; The statically linked parser is compiled into the portable intermediate representation bytecode, so that the decoding algorithm is bound to the content data in the form of the portable intermediate representation bytecode.

3. The self-contained electronic archive processing method according to claim 1, characterized in that, The step of serializing the document logical structure into content data includes: The extracted document logical structure is constructed into a self-describing abstract syntax tree; A pattern definition for defining node attributes is embedded in the self-describing abstract syntax tree, and the self-describing abstract syntax tree after embedding the pattern definition is serialized to generate the content data.

4. The self-contained electronic archive processing method according to claim 1, characterized in that, The step of encapsulating the portable intermediate representation bytecode, the content data, and the static resource set into an archive file includes: The portable intermediate representation bytecode, the content data, and the static resource set are stored in the intermediate representation bytecode area, the content area, and the resource area respectively according to the partitioning structure to generate the archive file.

5. The self-contained electronic archive processing method according to claim 4, characterized in that, The partition structure also includes a host interface specification description area that records the calling permission specifications; Before assembling and generating the archive file according to the partition structure, the process also includes: Import function signatures are defined in the host interface specification description area to restrict the access permissions of the portable intermediate representation bytecode to the host environment; The import function signature includes at least one of the following: a pixel write function for writing data to the frame buffer provided by the host, a resource read function for reading data from the archive file, an error reporting function for reporting errors, and a memory request function for allocating linear memory for the portable intermediate representation bytecode.

6. The self-contained electronic archive processing method according to claim 4, characterized in that, When generating the archive file, the method further includes: The hash value of each partition is calculated based on the partition structure to generate a partition hash chain; The partition hash chain and the digital signature for the archived file are stored in the metadata and signature area, respectively, so that the parsing terminal can perform integrity verification on the archived file before restoring the electronic archive.

7. A self-contained electronic archive processing method, characterized in that, Executed by the parsing terminal, the method includes: Obtain an archive file, which includes portable intermediate representation bytecode, content data, and a set of static resources; A host is loaded to run the portable intermediate representation bytecode. The portable intermediate representation bytecode is run through the host to read the content data and the static resource set. Based on the portable intermediate representation bytecode and the static resource set, the content data is parsed and rendered to output the restored electronic archive.

8. The self-contained electronic archive processing method according to claim 7, characterized in that, The loading of a host for running the portable intermediate representation bytecode, and the running of the portable intermediate representation bytecode through the host, includes: The host extracts the portable intermediate representation bytecode from the intermediate representation bytecode area of ​​the archive file and performs integrity verification on the archive file. Obtain the import function from the host interface specification description area of ​​the archive file; The host instantiates the portable intermediate representation bytecode and injects the import function into the instantiated portable intermediate representation bytecode. The execution of the portable intermediate representation bytecode is initiated through the host, so as to run the portable intermediate representation bytecode through the host.

9. The self-contained electronic archive processing method according to claim 8, characterized in that, The step of reading the content data and the static resource set, and parsing and rendering the content data based on the portable intermediate representation bytecode and the static resource set, includes: During the execution of the portable intermediate representation bytecode, the resource reading function in the import function is called to read the content data and the static resource set from the partition corresponding to the archive file into the linear memory provided by the host. The content data is parsed in the linear memory, and the page rendering result is generated by combining the static resource set through layout calculation; The pixel writing function in the import function is called to output the page rendering result to the frame buffer provided by the host, so as to map the page rendering result to the display device for display.

10. The self-contained electronic archive processing method according to claim 8, characterized in that, The steps for performing integrity verification on the archived file include: Extract the partition hash chain and the digital signature from the metadata and signature area of ​​the archived file; The authenticity of the archive file's origin is verified based on the digital signature, and the integrity of the archive file is determined by hashing the portable intermediate representation bytecode, the content data, and the static resource set stored in the intermediate representation bytecode area, the content area, and the resource area, respectively, based on the partition hash chain.

11. The self-contained electronic archive processing method according to claim 7, characterized in that, Under the condition that the host is unavailable, the method further includes: Based on the partition structure in the archive file, locate the content area and extract the serialized content data from the content area; Obtain the pattern definition embedded in the content data, and parse the content data node by node according to the pattern definition to restore the self-describing abstract syntax tree; The electronic archive is restored by traversing the self-describing abstract syntax tree, extracting the content of text nodes, recombining them, and outputting the results.

12. A self-contained electronic archive processing device, characterized in that, The device, located in the archiving generation equipment, includes: The extraction module is used to acquire electronic archives and extract the document logical structure and static resource set from the electronic archives; A serialization module is used to serialize the document logical structure into content data; The compilation module is used to compile the parsing and rendering logic for the content data into portable intermediate representation bytecode; The encapsulation and sending module is used to encapsulate the portable intermediate representation bytecode, the content data, and the static resource set into an archive file, and send the archive file to the parsing terminal, so that the parsing terminal can parse and render the content data based on the portable intermediate representation bytecode and the static resource set to restore the electronic archive.

13. A self-contained electronic archive processing device, characterized in that, The device, located in the parsing terminal, includes: The file acquisition module is used to acquire archived files, which include portable intermediate representation bytecode, content data, and a set of static resources. A host loading module is used to load a host for running the portable intermediate representation bytecode, and to run the portable intermediate representation bytecode through the host to read the content data and the static resource set; The parsing and rendering module is used to parse and render the content data based on the portable intermediate representation bytecode and the static resource set, so as to output the restored electronic archive.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the electronic archive self-containment processing method as described in any one of claims 1 to 11.