The Extensible Markup Language (XML) has emerged as a de facto standard language for exchanging data among disparate information systems. Since the majority of data in the world is stored in databases, the conversion of such data into XML documents is indispensable for real world usage. In this paper, we propose the algorithm for mapping the Entity Relationship model (ER model) to the XML document at the metadata level to address this conversion issue effectively. This is a progressive attempt to automatically generate the XML document from the conceptual database schema using the XML Schema. In this paper, we introduce a set of ER-to-XML mapping rules and then show the mapping algorithm based on these rules. We also introduce the XML Schema which forms the groundwork of this mapping algorithm