14. A non-transitory computer-readable storage medium carrying one or more sequences of instructions, wherein execution of the one or more sequences of instructions by one or more processors causes the one or more processors to perform the steps of: a database server rewriting an original query into a rewritten query, said original query including: a first path-based expression in a SELECT clause that evaluates to first one or more values, and second path-based expressions in both a FROM clause and a WHERE clause; wherein the rewritten query includes a first rewritten expression that causes the first one or more values to be computed using streaming evaluation; wherein the rewritten query includes second rewritten expressions that correspond to said second path-based expressions; said database server computing the first written expression using streaming evaluation; said database server computing the second rewritten expressions using XML index evaluation of an XML index that indexes nodes in a collection of XML documents, wherein each index entry of entries of said XML index contains location data that identifies a location of an element within a representation of an XML document of said collection of XML documents; wherein the second rewritten expression evaluates to an output for location information within a representation of a particular XML document, wherein said output of said second rewritten expression is an input to said first rewritten expression, wherein said location information is derived from location data from an entry in said XML index; and wherein computing the first rewritten expression includes using said location information to locate an element within said representation of said particular XML document using streaming evaluation.
14. A non-transitory computer-readable storage medium carrying one or more sequences of instructions, wherein execution of the one or more sequences of instructions by one or more processors causes the one or more processors to perform the steps of: a database server rewriting an original query into a rewritten query, said original query including: a first path-based expression in a SELECT clause that evaluates to first one or more values, and second path-based expressions in both a FROM clause and a WHERE clause; wherein the rewritten query includes a first rewritten expression that causes the first one or more values to be computed using streaming evaluation; wherein the rewritten query includes second rewritten expressions that correspond to said second path-based expressions; said database server computing the first written expression using streaming evaluation; said database server computing the second rewritten expressions using XML index evaluation of an XML index that indexes nodes in a collection of XML documents, wherein each index entry of entries of said XML index contains location data that identifies a location of an element within a representation of an XML document of said collection of XML documents; wherein the second rewritten expression evaluates to an output for location information within a representation of a particular XML document, wherein said output of said second rewritten expression is an input to said first rewritten expression, wherein said location information is derived from location data from an entry in said XML index; and wherein computing the first rewritten expression includes using said location information to locate an element within said representation of said particular XML document using streaming evaluation. 15. The non-transitory computer-readable storage medium of claim 14 , wherein computing the first rewritten expression includes using said location information to locate an element within said representation.