1. A method for processing queries, the method comprising the computer-implemented steps of: generating a first representation of a certain query, wherein the certain query includes a certain operator to be performed based on an XML Path Language (XPath) expression, wherein the XPath expression indicates a plurality of location paths into which the XPath expression can be expanded; and rewriting the first representation into a second representation that corresponds to an equivalent query of the certain query, wherein rewriting the first representation comprises: expanding the XPath expression into the plurality of location paths; and based on the certain operator, including a plurality of operators in the second representation, wherein the plurality of operators include: a first set of operators to be performed based on each of the plurality of location paths, and a second set of operators to be performed based on data to be returned from at least one operator included in the first set of operators.