出错代码
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.dom4j.Document;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.junit.Test;
public class ReadXML {
public static void main(String[] args) throws Exception {
String path = "F:\\myclipseworkspace\\dom4j\\src\\db.xml";
InputStream in = new FileInputStream(path);
OutputStream os = new FileOutputStream(path);
SAXReader reader = new SAXReader();
Document document = reader.read(path);
document.getRootElement().addElement("user").addElement("username").setText("123");
XMLWriter writer = new XMLWriter(new FileOutput