import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ReaderXml {
public Double reader(){
Double d = 0.0;
try {
SAXReader reader = new SAXReader();
Document document = reader.read(new File("src/sss.xml"));
Element root = document.getRootElement();
// Element element = (Element)root.selectSingleNode("/PAGE/HEAD");
// element.setText("abc");
d = new Double(root.getText());
} catch (Exception e) {
}
return d;
}
public void setXML(Integer value) {
try {
SAXReader reader = new SAXReader();
Document document = reader.read(new File("src/sss.xml"));
Element root = document.getRootElement();
root.setText(value+"");
FileOutputStream fos = new FileOutputStream(new File("src/sss.xml"));
fos.write(document.asXML().getBytes());
fos.flush();
} catch (Exception e) {
}
}
}