Searching document object model elements by attribute order priority
First Claim
1. A method for searching a plurality of objects within ea Document Object Model (DOM) document, the method comprising:
- receiving an XPath expression, the XPath expression comprising a plurality of attributes and one or more logical operators defining relationships between the attributes, the logical operators comprising one or more of a logical AND, a logical OR, or a logical NOT;
generating a tree structure representing the XPath expression, the tree structure comprising a plurality of nodes arranged according to a hierarchical relationship between the attributes based upon positions of the plurality of attributes and the one or more logical operators in the XPath expression, each node in the plurality of nodes representing a group of one or more attributes from the plurality of attributes, the plurality of nodes including a set of leaf nodes that do not have any child nodes;
associating a weight value with each node in the plurality of nodes in the tree structure based upon a location of the node in the tree structure, wherein the associating comprises;
assigning a weight value to each of the set of leaf nodes based upon the positions of the plurality of attributes corresponding to the set of leaf nodes in the XPath expression; and
for each node in the plurality of nodes other than the set of leaf nodes, assigning a weight value to the node based upon weight values assigned to one or more child nodes of the node;
for each object in the plurality of objects within the DOM document, calculating a score for the object based on a comparison of one or more attributes of the object to the plurality of attributes within the XPath expression and based upon the weight values associated with the plurality of nodes in the tree structure;
determining a target object from the plurality of objects within the DOM document, based on the scores calculated for the plurality of objects; and
outputting information related to the target object as a response to the receipt of the XPath expression.
1 Assignment
0 Petitions
Accused Products
Abstract
Embodiments of the invention provide systems and methods for searching for elements of a document based on an order priority of attributes of a query expression. According to one embodiment, a method of searching a plurality of objects of a document, such as elements of a DOM document, can comprise generating a query expression with attributes related to a target object of the document. For example, the expression can comprise an XPath expression. The attributes of the query expression can be parsed into one or more attribute groups, each comprising at least one attribute, based on logical operators between the attributes. Each one or more attribute groups of each expression can be weighted and a search can be performed for the target object in the document based on the weighted one or more attribute groups of the query expression.
-
Citations
11 Claims
-
1. A method for searching a plurality of objects within ea Document Object Model (DOM) document, the method comprising:
-
receiving an XPath expression, the XPath expression comprising a plurality of attributes and one or more logical operators defining relationships between the attributes, the logical operators comprising one or more of a logical AND, a logical OR, or a logical NOT; generating a tree structure representing the XPath expression, the tree structure comprising a plurality of nodes arranged according to a hierarchical relationship between the attributes based upon positions of the plurality of attributes and the one or more logical operators in the XPath expression, each node in the plurality of nodes representing a group of one or more attributes from the plurality of attributes, the plurality of nodes including a set of leaf nodes that do not have any child nodes; associating a weight value with each node in the plurality of nodes in the tree structure based upon a location of the node in the tree structure, wherein the associating comprises; assigning a weight value to each of the set of leaf nodes based upon the positions of the plurality of attributes corresponding to the set of leaf nodes in the XPath expression; and for each node in the plurality of nodes other than the set of leaf nodes, assigning a weight value to the node based upon weight values assigned to one or more child nodes of the node; for each object in the plurality of objects within the DOM document, calculating a score for the object based on a comparison of one or more attributes of the object to the plurality of attributes within the XPath expression and based upon the weight values associated with the plurality of nodes in the tree structure; determining a target object from the plurality of objects within the DOM document, based on the scores calculated for the plurality of objects; and outputting information related to the target object as a response to the receipt of the XPath expression. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A machine-readable memory device comprising a set of instructions stored therein which, when executed by a processor, cause the processor to search elements within a Document Object Model (DOM) document by:
-
receiving an XPath expression, the XPath expression comprising a plurality of attributes and one or more logical operators defining relationships between the attributes, the logical operators comprising one or more of a logical AND, a logical OR, or a logical NOT; generating a tree structure representing the XPath expression, the tree structure comprising a plurality of nodes arranged according to a hierarchical relationship between the attributes based upon positions of the plurality of attributes and the one or more logical operators in the XPath expression, each node in the plurality of nodes representing a group of one or more attributes from the plurality of attributes, the plurality of nodes including a set of leaf nodes that do not have any child nodes; associating a weight value with each node in the plurality of nodes in the tree structure based upon a location of the node in the tree structure, wherein the associating comprises; assigning a weight value to each of the set of leaf nodes based upon the positions of the plurality of attributes corresponding to the set of leaf nodes in the XPath expression; for each node in the plurality of nodes other than the set of leaf nodes, assigning a weight value to the node based upon weight values assigned to one or more child nodes of the node; for each object in the plurality of objects within the DOM document, calculating a score for the object based on a comparison of one or more attributes of the object to the plurality of attributes within the XPath expression and based upon the weight values associated with the plurality of nodes in the tree structure; determining a target object from the plurality of objects within the DOM document, based on the scores calculated for the plurality of objects; and outputting information related to the target object as a response to the receipt of the XPath expression. - View Dependent Claims (7, 8, 9, 10)
-
-
11. A system for searching a plurality of objects within a Document Object Model (DOM) document, the system comprising:
-
a processor; and a memory communicatively coupled with and readable by the processor, the memory having stored therein a set of instructions which, when executed by the processor, cause the processor to; receive an XPath expression, the XPath expression comprising a plurality of attributes and one or more logical operators defining relationships between the attributes, the logical operators comprising one or more of a logical AND, a logical OR, or a logical NOT; parse the plurality of attributes of the XPath expression into a plurality of attribute groups using the placement of the logical operators between the attributes of the XPath expression; generate a tree structure representing the XPath expression, the tree structure comprising a plurality of nodes arranged according to a hierarchical relationship between the attributes based upon positions of the plurality of attributes and the one or more logical operators in the XPath expression, each node in the plurality of nodes representing a group of one or more attributes from the plurality of attributes, the plurality of nodes including a set of leaf nodes that do not have any child nodes; associate a weight value with each node in the plurality of nodes in the tree structure based upon a location of the node in the tree structure, wherein the associating comprises; assigning a weight value to each of the set of leaf nodes based upon the positions of the plurality of attributes corresponding to the set of leaf nodes in the XPath expression, wherein assigning weight values to each particular leaf node comprises; determining the index of the particular leaf node within the XPath expression; and determining a weight value for the particular leaf node as exponentially based on the index of the particular leaf node within the XPath expression; for each node in the plurality of nodes other than the set of leaf nodes, assigning a weight value to the node based upon weight values assigned to one or more child nodes of the node, wherein assigning the weight values to each particular node other than a leaf node comprises; determining whether an expression represented by the particular node evaluates as false; in response to determining the expression represented by the particular node evaluates as false, scoring each child node of the node as zero; in response to determining the expression represented by the particular node does not evaluate as false, scoring each child node of the node as zero; summing weight values of each child node of the particular node; determining whether an expression represented by the particular node evaluates as false; and for each object in the plurality of objects within the DOM document, calculating a score for the object based on a comparison of one or more attributes of the object to the plurality of attributes within the XPath expression and based upon the weight values associated with the plurality of nodes in the tree structure; determining a target object from the plurality of objects within the DOM document, by selecting object in the plurality of objects having the highest calculated score; and outputting information related to the target object as a response to the receipt of the XPath expression.
-
Specification