DOM的数据回写哪里错了怎么没有创建新的文件

@Test

public void dome3() throws Exception {

DocumentBuilderFactory builderfactory = DocumentBuilderFactory

.newInstance();

DocumentBuilder builder = builderfactory.newDocumentBuilder();


Document document = builder.parse("person.xml");

TransformerFactory transformerfactory = TransformerFactory

.newInstance();


Transformer transformer = transformerfactory.newTransformer();


DOMSource domsource = new DOMSource(document);//domsource构造数据源

StreamResult result = new StreamResult(new File("persons.xml"));

transformer.transform(domsource, result);


}


学无丶直径
浏览 1538回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java