1. A method for dynamically generating an XQuery for an XML database storing a plurality of non-XML documents, each non-XML document having a corresponding shadow XML document in the XML database, the method comprising: providing a plurality of static units of XQuery code, the static units being predefined in accordance with the non-XML documents; combining the one or more static units according to dynamic input from a user to generate the XQuery; and storing the XQuery.