1. A method for exchanging data from an Enterprise Resource Program or Customer Relationship Management application between a database table and an XML document wherein the database table is a relational database table and the query structure is an SQL query structure and wherein the database table is represented in the form of an internal class, the method comprising: defining a query structure providing: (1) a data structure of the XML document; (2) a data storage strategy for de-serializing the XML document to the database table; and (3) a data retrieval strategy for serializing the XML document from the database table; defining a programmable entity including: (1) business logic specific to a business process; (2) a data storage strategy specific to the business process and (3) a data retrieval strategy specific to the business process; de-serializing the XML document to the database table using the programmable entity and using the query structure including validating a business rule associated with a document class corresponding to the XML; comprising initiating in response to receiving an XML document; calling a constructs request on document classes to create an instance of the specific document class that corresponds to the received XML document; creating an instance of the specific document class; calling a readFromXML( )request on the document classes to de-serialize the received XML document and to save it in the database including: a filename that indicate a name and location of the file that the output XML document should read from, a docType that specifies how the document should be created in the database, a gatewayDocSetup that records from the GatewayDocSetup a table identifying the value mapping to be performed; de-serializing the received XML document into a corresponding internal class; setting a value of the <documents type>property of the received XML document to docType; persisting the received XML document to the database by invoking save( ) method on each internal class and document class related to the received XML document; serializing data from the database table to the XML document using the programmable entity and using the query structure including performing a lifecycle check on the XML document wherein the lifecycle check determines if the XML document respects lifecycle rules related to the XML document; comprising: creating an instance of the specific document class identified by an actionId, executing a particular query associated with the document class to retrieve data from database tables; creating corresponding internal class objects for each of the database tables identified in the particular query and providing the internal class objects with the retrieved data; calling a saveAsXML( )request on the document classes to serialize the retrieved data into an XML document that corresponds to the particular query, including: keyFields which comprise a container with the unique keys that identify a database record to fetch from a “root” table of the document through the internal classes: filename that comprises a name and location of the file that the output XML document should be written to; filterXSD that comprises a file name and location of the XSD schema to read and use for filtering; gatewayDocSetup that comprises a record from the GatewayDocSetup table identifying a value mapping to be performed; docPurpose that comprises information that specifies whether the document is an original, a duplicate or a pro forma; populating document level properties of the document class instances with the information about the document type, as supplied by the docPurpose parameter; selecting the data in the database to be serialized into an XML document using keyFields parameter as the primary key; reading the XML schema from thefilterXSD file to be used for filtering; filtering out any property from the relevant internal classes for which there is no corresponding element in the XML schema used for filtering; serializing each internal class and document class related to the desired document and an writing an output file to a file identified by filename; generating an XML schema based on: (1) the document class, (2) the database table; and (3) the query structure and (4) the programmable entity comprising calling a construct( )request on the document classes to create an instance of the specific document class that corresponds to the desired XML document for which an XML schema needs to be generated; identifying the class of the specific document desired by including an actionId as a parameter that identifies the class of the received document; creating an instance of the specific document class identified by the actionId; invoking a saveXSDschema( )request on the document classes to generate the XML schema; supplying a filename parameter with the saveXSDschema( )request, wherein the filename specifies the name and location of the XML schema file to be generated; saving a back-up copy of an existing XML schema located in fileName; traversing a query structure of a corresponding document class and generate the corresponding XML schema fragment for each corresponding internal class or for each corresponding data table if there is no corresponding internal class; writing the generated XML schema to the file whose name/path is passed as a parameter to the saveXSDschema( )request; and deleting the back-up copy of the old XML schema.