1.修改xml代码,
Element stuEle = (Element) doc.selectSingleNode("jhjjkk");
stuEle.element("age").setText("scf"); /
stuEle.element("sex").setText("sgh");
2.删除xml代码,
public void sdsdd(){
SAXReader reader = new SAXReader(); Document doc = reader.read(new File("skjdd.xml")); Element Elm = (Element) doc.selectSingleNode("kshjd"); stuEle.getParent().remove(Elm);
}