1. An apparatus for converting data between a relational format and an XML document, the apparatus comprising: a relational application database containing relational data; means for creating an XML Mapping Definition from metadata, wherein the XML Mapping Definition comprises information relating relational data components to XML elements and relational data fields to XML elements or XML attributes, and said means for creating the XML Mapping Definition comprises means for collapsing one or more portions of an XML hierarchy comprising the XML elements and attributes to reduce the number of tables used in the relational application database; means for selecting relational data from the relational application database; means for converting the relational data to XML data using the XML Mapping Definition; and means for storing the converted relational data in the XML document.