The invention provides a method for converting relational models to XML (extensive markup language), and relates to relational data definition structural models, XML mode definition, mapping rule dictionaries and mapping rule dictionary construction algorithms. Key problems in the aspect of structures between the relational models and the XML can be solved by the aid of the method, in other words,effective mapping can be defined, the method is mainly applied to converting the relational models in various fields to XML models, and flat two-dimensional structures can be mapped to nested hierarchical structures. Data structures in the relational models, data operation process sets, data integrity constraint information and relevant information of element declaration, attribute declaration, naming spaces and the like in the XML are defined by the aid of the method, a mapping rule dictionary is designed and is constructed by the aid of algorithms, and accordingly relational data can be converted to the XML. Compared with the traditional method, the method has the advantages that the conversion efficiency can be greatly improved, constraint information in relational modes can be completely kept to the greatest extent, and the traditional conversion processes can be optimized from the aspects of the conversion efficiency and the conversion quality.