import org.jdom.* ;
import org.jdom.output.* ;
import org.jdom.input.* ;
import java.io.* ;
import java.util.*;
/*
作者:雨傘
時間:2004/12/28
*/
public class JavaXml {
public String path=null;
public String XmlFileName=null;
public SAXBuilder sax=null;
public Document doc=null;
public Element root=null;
public List xlist=null;
public Element e=null;
public Element value=null;
public String getTest(){
return new String("haha");
}
public JavaXml(){
}
public String init(){
InputStream is = getClass().getResourceAsStream("global.properties");
Properties dbProps = new Properties();
try {
dbProps.load( is ) ;
}
catch ( Exception e ) {
return ("error file");
}
this.path=dbProps.getProperty("XmlPath");
return ("ok");
}
public void get(int child){
this.e=(Element)xlist.get(child);
}
public String getValue(String name){
this.value=e.getChild(name);
return this.value.getText();
}
public void setValue(String name,String value)throws Exception{
this.value=e.getChild(name);
this.value.setText(value);
XMLOutputter xmlout=new XMLOutputter();
xmlout.output(doc,new FileOutputStream(path+XmlFileName));
}