8. A non-transitory computer accessible memory medium storing program instructions for dynamically generating an XQuery for an XML database that stores a plurality of non-XML text documents, each non-XML document having a corresponding shadow XML document in a collection of shadow XML documents in the XML database, wherein the collection contains the corresponding shadow XML documents on which the XQuery is to be executed, wherein each shadow XML document comprises metadata extracted from the corresponding non-XML text document and wherein the XML database is configured for executing an XQuery on the shadow XML documents and for retrieving corresponding non-XML text documents, wherein the program instructions are executable to: provide a FLWOR expression comprising a plurality of units of XQuery code, the plurality of units being predefined based on the non-XML text documents and comprising at least one predefined text retrieval function, wherein the FLWOR expression comprises a for clause predefined based on the shadow XML documents in the collection of shadow XML documents corresponding to the non-XML text documents, wherein the for clause indicates the collection of shadow XML documents and a doctype; and combine the one or more units according to dynamic input from a user to generate the XQuery, the dynamic input from the user defining a where clause including at least one dynamically defined condition for the XQuery.
14. The non-transitory computer accessible memory medium of claim 8 , wherein the program instructions are further executable to: present a GUI to the user, wherein the GUI comprises one or more buttons relating to the plurality of units; and receive the input from the user via the GUI.