7. The method of claim 1 , further comprising optimizing an XQuery that comprises at least one call of an indexing function by scanning the corresponding index of the indexing function when processing the XQuery.
1. A computer-implemented method for generating at least one index over XML documents in an XML database configured to operate in a computing system that includes at least one processor, the method comprising: executing, via the at least one processor, at least one indexing function defined in the XQuery language, each said indexing function being configured to accept an XML document as input and to return at least one computed result; storing each said computed result from the at least one indexing function as a key of the corresponding index; and storing a reference to the input XML document as a value of the index, wherein the at least one indexing function returns at least one XML substructure, and further comprising mapping each of the at least one XML substructures onto a tuple of type values and wherein each of the tuples is stored as a key of the index.