Xpath Engine Node Stack Traversal and Flagging
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing Xpath processing methods are inefficient in matching Xpath expressions with XML or JSON documents, leading to suboptimal performance in identifying and extracting elements, especially when dealing with large datasets and complex document structures.
Innovation Solution
A method and system that traverse a stack of nodes from top to bottom to match each step of an Xpath expression, using flags to identify matching nodes and perform loop traces for descendant axes, ensuring efficient matching by comparing flagged nodes against the expression steps, and determining if the path expression is matched based on node availability and step alignment.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If traditional Xpath processing methods are used to match expressions with XML or JSON documents, then the language capability to define expressions for identifying XML elements is provided, but the processing efficiency deteriorates when dealing with large datasets and complex document structures
Solution Approach 1:
The patent segments the Xpath expression into multiple steps (e.g., `//a[1]`, `//b[2]`) and processes each step independently by traversing the node stack in segments. This allows the system to handle complex expressions by breaking them down into manageable portions, improving processing efficiency while maintaining the full language capability.
Solution Approach 2:
The patent performs preliminary actions by pre-traversing the node stack to identify and flag nodes that match each step of the Xpath expression before final matching. This preliminary processing of the node stack allows for faster subsequent matching operations, resolving the contradiction between expression capability and processing speed.
2Measurement precision
If the node stack is traversed completely to match each step of the path expression, then accurate element identification is achieved, but the processing time increases
Solution Approach 1:
The system performs preliminary traversal of the node stack to flag nodes matching each Xpath step before final matching. This pre-processing identifies candidate nodes in advance, allowing the final matching operation to focus only on verifying flagged nodes rather than scanning the entire stack, thus reducing processing time while maintaining accuracy.
Solution Approach 2:
The patent uses feedback from the preliminary traversal to optimize the final matching process. By flagging nodes that match each step and using this feedback information, the system can quickly verify or reject candidates without re-traversing the entire stack, reducing processing time while preserving identification accuracy.
3Ease of operation
If flags are stored with each node to track matches, then the matching process becomes more systematic, but the memory consumption increases
Solution Approach 1:
The patent uses simple Boolean flags stored with each node during the matching process. These flags are temporary and discarded after use, providing a lightweight mechanism for tracking matches without requiring complex data structures. This approach maintains systematic matching while minimizing memory consumption.
Data Source
AI summary
The present invention is directed towards systems and methods for efficient Xpath matching of a document comprising Extensible Markup Language (XML) or JavaScript Object Notation (JSON). A Xpath engine identifies an Xpath expression for processing values in the document, which is represented by a stack of nodes. The device may traverse the stack from top to bottom to match each step of the Xpath expression to a type and name of one or more nodes in the stack. The device may store a flag in each node that matches a step of the Xpath expression. Responsive to encountering a leaf node, the device may trace bottom to top from the leaf node to one or more flagged nodes in the stack and compare each flagged node against a corresponding step of the path expression. Responsive to the tracing of the flagged nodes, the device determines if the path expression is matched.


