Streaming XML Validation Using Stack-Based Parsing

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The DOM approach for validating XML documents is inefficient due to its memory-intensive nature, unsuitability for streaming validation, and adverse impact on system performance, especially when handling large documents, which limits its effectiveness with StAX-based parsers and scales poorly.

Innovation Solution

A streaming validation method that uses a stack-based approach to validate XML documents part-by-part, allowing for efficient validation of XML elements against XML schemas, including simple, complex, and content particle types, without requiring the entire document to be loaded into memory, and operates in both pipeline and standalone modes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the DOM approach is used to validate XML documents, then validation can be performed against XML schemas, but the entire document must be loaded into memory which increases memory requirements and reduces scalability

Engineering Contradiction:
Improvevalidation accuracyVSAvoidmemory consumption
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent segments the XML document validation process into incremental parts that can be processed sequentially. Instead of loading the entire document into memory as a single DOM tree, the validator processes the document in chunks or segments, maintaining only the current validation context in memory. This segmentation allows validation of large documents with limited memory resources while preserving validation accuracy through systematic processing of each segment against the XML schema.

Inventive Principle:
Principle #1Segmentation

2Reliability

If the DOM approach is used to validate XML documents, then comprehensive validation can be performed, but system performance deteriorates due to memory-intensive operations and recursive tree traversal

Engineering Contradiction:
Improvevalidation completenessVSAvoidvalidation speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent implements a dynamic validation approach that adapts to the document structure and size. The validator dynamically adjusts its processing strategy based on the current validation state, using iterative methods instead of fixed recursive traversal. This dynamic approach allows the system to maintain validation completeness while improving performance by avoiding the overhead of building and traversing large DOM trees, particularly for large or deeply nested documents.

Inventive Principle:
Principle #15Dynamics

3Reliability

If the DOM approach is used for XML validation, then the validation process can handle complex XML structures, but it is unsuitable for streaming validation and event-driven parsing

Engineering Contradiction:
Improvevalidation thoroughnessVSAvoidstreaming compatibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent introduces an intermediary validation layer that bridges the gap between streaming/event-driven parsing and thorough XML schema validation. This intermediary validator receives events or data chunks from StAX-based parsers and performs validation checks incrementally, maintaining validation thoroughness without requiring the entire document to be available. The intermediary approach enables compatibility with event-driven parsing models while preserving validation reliability through systematic processing of validation rules against the XML schema.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS7992081B2Streaming validation of XML documents
Publication Date: 2011.08.02 ORACLE INT CORP
  • US7992081B2 patent drawing
  • US7992081B2 patent drawing
  • US7992081B2 patent drawing

AI summary

A method and apparatus for streaming validation of XML documents is provided. A particular event of a series of events is received. The series of events is generated as an XML document is parsed by a parser, and the received particular event indicates that the parser has encountered a particular part of the XML document. The particular part of the XML document indicated by the particular event is then received. A current validation state for the XML document is determined. The current validation state, which is one of a plurality of validation states for the XML document, indicates a validation type associated with the particular part of the XML document. Based on at least the current validation state, the particular part of the XML document is validated against an XML schema that defines the structure of the XML document.