1. A method for generating at least one index ( 10 ) over XML documents ( 30 ) in an XML database ( 40 ); the method comprising the steps of: a. executing at least one indexing function ( 20 ) defined in the XQuery language; each indexing function ( 20 ) accepting an XML document ( 30 ) as input and returning at least one computed result; and b. storing each of the at least one computed results from the at least one indexing function ( 20 ) as a key ( 11 ) of the corresponding index ( 10 ) and a reference to the input XML document ( 30 ) as a value ( 12 ) of the index ( 10 ).