Framework-based1 applications are quite popularly used in current commercial applications. Framework-based applications are often controlled by XML configuration files. However, most of these frameworks are complex or not well documented, which poses a great challenge for programmers to correctly utilize them. To overcome these difficulties, we propose a new method to recommend XML configuration snippets automatically through mining tree patterns from the application repository with the aim of assisting the programmer to generate proper XML configurations during the product phase. This method is further realized into a new tool XMLSnippet. In this paper, we will systematically present the core techniques of the proposed method, including closed frequent tree pattern mining, prefix tree based indexing and three types of queries (type query, structural query and context query) for online coding assistance. Experimental results show that these techniques are efficient for recommending reusable XML configuration snippets and consequently improve the productivity of programmers effectively with the assistance of the tool when they program with XML-based frameworks. © 2012 IEEE.