运行之后,,没有生成newbooks.xml是怎么回事????????
ArrayList<Book> booklist=parsexml();
SAXTransformerFactory factory=(SAXTransformerFactory)SAXTransformerFactory.newInstance();
try {
TransformerHandler tfh=factory.newTransformerHandler();
Transformer tf=tfh.getTransformer();
tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
tf.setOutputProperty(OutputKeys.INDENT, "yes");
File f=new File("src/rec/newbooks.xml");
if(!f.exists()){
f.createNewFile();
}
Result res = new StreamResult(new FileOutputStream(f));
tfh.setResult(res);
tfh.startDocument();
AttributesImpl atts = new AttributesImpl();
tfh.startElement("", "", "bookstore", atts);
tfh.endElement("", "","bookstore");
tfh.endDocument()
运行之后,,没有生成newbooks.xml是怎么回事????????