将dom.document存放在文件中

时间:2023-01-22 17:00:28
File   f   =   new   File("C:\\d.xml");  
    FileWriter writer;
 try {
  writer = new   FileWriter(f);
     XMLOutputter   outputter   =   new   XMLOutputter();  
     // outputter.setEncoding("gb2312");  
     outputter.output(resDoc,   writer);  
     writer.close(); 
 } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }