public static void generateXmlFile() throws DocumentException {
        
        Document document = generateDocument();
        XMLWriter out = null;
        
        BufferedWriter bw = null;
        OutputStreamWriter osw = null;
        FileOutputStream fos = null;
        
        try {
            File xmlFile = new File("UseCases\\xml\\"+xmlCase);//输出xml的路径
            if (xmlFile.exists()) {
            	//如果已经存在则删除
            	xmlFile.delete();
            } 
            fos = new FileOutputStream(xmlFile);
            osw = new OutputStreamWriter(fos,"UTF-8");//指定编码，防止写中文乱码
            bw = new BufferedWriter(osw);
            
            //对xml输出格式化
            OutputFormat format = OutputFormat.createPrettyPrint();
            format.setEncoding("UTF-8");
            out = new XMLWriter(bw, format);
            out.write(document);
            
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if(out != null) {
                    out.close();
                }
                if(bw != null) {
                    bw.close();
                }
                if(osw != null) {
                    osw.close();
                }
                if(fos != null) {
                    fos.close();
                }
                
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }