This paper describes a generic framework of which semantics-based XML data can be derived from legacy databases. It consists in first recovering the conceptual schema of the database through reverse engineering techniques, and then in converting this schema, or part of it, into XML-compliant data structures. Both steps heavily rely on generic schema transformation techniques, while all the schemas involved in the whole process are expressed in a unique model, named GER. Transformations between schemas are expressed as sequences of reversible transformation primitives. The reversed sequence can be used to automatically translate query, data or updates posed on XML.