Patent ID: 7346609

Claim:
A method for generating hierarchical path value index keys from an XPath expression, the method comprising: scanning a plurality of data nodes of a document; building a tree of query nodes from the XPath expression; determining if each of the plurality of data nodes of the document matches corresponding query nodes associated with the tree of query nodes, including determining that each of the plurality of data nodes matches corresponding query nodes associated with the tree of query nodes responsive to a root query node associated with the tree of query nodes matching a root data node of the plurality of data nodes; names of the plurality of data nodes of the document matching names of the corresponding query nodes within the tree of query nodes; and relationships between the plurality of data nodes matching relationships between the corresponding query nodes within the tree of query nodes; and placing the plurality of data nodes that match the corresponding query nodes associated with the tree of query nodes in a match stack table, the plurality of data nodes placed in the match stack table representing the hierarchical path value index keys, otherwise outputting a result indicating that none of the plurality of data nodes of the document matches corresponding query nodes associated with the tree of query nodes responsive to that data nodes of the document not matching corresponding query nodes associated with the tree of query nodes, wherein determining if each of the plurality of data nodes of the document matches corresponding query nodes associated with the tree of query nodes further comprises clearing old matches from the match stack table; searching a direct active state hash table and an indirect active state hash table to identify active states with a same name as a given data node and placing the identified active states in a list; clearing direct active states in the direct active state hash table; skipping descendants of a given data node if the list is empty and a level of the data node is less than a fixed level; placing the data node in an output stream, if a corresponding query node in the list is a leaf node; adding indirect nodes of the corresponding query node to an indirect active state hash table responsive to the corresponding query node not being the leaf node and the match stack table for the corresponding query node being empty; and pushing a match entry for the corresponding query node onto the match stack table and adding direct states of the corresponding query node to the direct active state hash table.