Abstract. An efficient method for transforming XML Schema into programming language is the development basis of XML related software. In this paper, we propose an algorithm design, which is used to transform XML Schema document into Java codes. Firstly, we studied XML Schema elements and nested relation between elements in all cases. Then we studied DOM API and used DOM parser to parse XML Schema document. Thirdly, we studied Deep First Search algorithm and used it to traverse parsed result. During the traversing process, create corresponding Java objects for XML Schema elements. Finally, we got a collection of Java objects, which is organized according to nested relation between elements. Except notation and anyAttribute, the algorithm can transform the other elements contained in XML Schema document into Java objects, which makes sure that the collection of transformational Java objects is an equivalent representation of XML Schema document.