要使用dom4j操作XML的话必须导入一个dom4j-1.6.1的jar包。
还有,如果要对XML进行CUD操作的话必须执行:
save(Document document) throws FileNotFoundException,2 UnsupportedEncodingException, IOException {FileOutputStream out = new FileOutputStream(“src/操作XML/person.xml”);5XMLWriter writer = new XMLWriter(out);writer.write(document);8 writer.close();9},才会看到属于自己的那一片晴朗的天空。