XML Parser Generation via Structural Template Extraction
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current XML parsing technologies, such as DOM and SAX, are inefficient in parsing documents due to their lack of adaptability and high processing requirements, as they require complete tree traversal or event-driven processing, which can be costly and time-consuming, especially for uniformly formatted computer-generated XML documents.
Innovation Solution
A method is developed to generate a parser by scanning a sample XML document, extracting a template with structural markup elements and removing data content, and then creating a parser that uses this template to efficiently extract data from similar documents by utilizing indices and counters, optimizing parsing speed and complexity.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If DOM parsing is used to parse complete documents into trees, then data extraction can be performed, but processing time and processor requirements increase significantly
Solution Approach 1:
The patent extracts only the necessary structural information (template) from the XML document without parsing the complete document into a full tree. The template contains only the structural markup elements needed for data extraction, eliminating the need to process entire document content and reducing processing time significantly.
Solution Approach 2:
The patent segments the XML parsing process into two distinct phases: template extraction (structural analysis) and data extraction (content retrieval). By separating these functions and using a pre-generated template for subsequent parsing, the system avoids re-processing the entire document structure repeatedly, thereby reducing overall processing time.
2Ease of operation
If SAX parsing is used to provide events to user application, then processing can be event-driven, but adaptability to different document formats is limited
Solution Approach 1:
The patent performs preliminary template extraction from a sample document before actual data parsing occurs. This pre-generated template captures the specific structural patterns of the XML format, enabling the parser to be highly adapted to that format while maintaining event-driven processing capabilities. The template is prepared in advance and reused for subsequent parsing operations.
Solution Approach 2:
The patent creates a dynamic parser that adapts to different XML formats by generating templates specific to each document type. The parser can switch between different templates based on the document format, providing both event-driven processing and format adaptability. The template generation process allows the system to dynamically adjust to new document structures.
3Loss of information
If complete tree traversal is performed to extract data, then all data can be accessed, but processing complexity and costs increase
Solution Approach 1:
The patent extracts only the structural template information from the XML document, leaving out the actual data content during the template generation phase. This allows the system to access all structural information needed for data extraction without processing the complete document content, thereby reducing processing complexity while maintaining data accessibility.
Solution Approach 2:
The patent performs preliminary extraction of structural templates before actual data retrieval operations. By pre-processing and storing the structural information in a template format, the system can quickly access and extract data without re-traversing the complete document tree, reducing both processing complexity and time requirements.
4Productivity
If template extraction is performed from sample document, then parsing efficiency is improved, but initial processing time is required
Solution Approach 1:
The patent performs template extraction as a one-time preliminary action from a sample document, and then reuses the generated template for parsing multiple documents. The initial time investment in template generation is amortized across multiple parsing operations, significantly improving overall parsing efficiency and productivity.
Solution Approach 2:
The patent creates a template copy of the XML structure that can be reused for parsing multiple documents of the same format. Instead of re-analyzing the complete document structure for each parsing operation, the system uses the pre-generated template template, eliminating redundant processing and improving parsing efficiency for subsequent documents.
Data Source
AI summary
A parser is generated for parsing a marked up document. A template of a sample marked up document chosen by a user is extracted. The template comprises elements of the structural markup of the sample document with their data contents removed. The parser for parsing a marked up document is generated. The parser is generated in the form of code based on the extracted template in such a manner that the parser is adapted to extract any elements and associated data content of the marked up document to be parsed corresponding to the elements of the extracted template.


