Document doc=new Document();
Element element=new Element("数据导出");
BllAcademicState daochu = new BllAcademicState();
ResultSet rs;
try {
rs=Dboparetion.execQuery("SELECT * FROM memberinfo", null);
ResultSetMetaData meta=rs.getMetaData();
while(rs.next()){
Object[] objs = new Object[meta.getColumnCount()];
for (int i = 1; i <= meta.getColumnCount(); i++){
objs[i-1] = rs.getObject(i);
Element ele = new Element("xml");
ele.setText(objs[i-1]+"");
element.addContent(ele);
}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
doc.addContent(element) ;
XMLOutputter out = new XMLOutputter() ;
Format mat = Format.getCompactFormat() ;
out .setFormat(mat);
try {
out.output(doc,new FileOutputStream("数据导出.xml"));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JOptionPane.showMessageDialog(null, "设置成功!!");
System.out.println("脱机导出");
Element element=new Element("数据导出");
BllAcademicState daochu = new BllAcademicState();
ResultSet rs;
try {
rs=Dboparetion.execQuery("SELECT * FROM memberinfo", null);
ResultSetMetaData meta=rs.getMetaData();
while(rs.next()){
Object[] objs = new Object[meta.getColumnCount()];
for (int i = 1; i <= meta.getColumnCount(); i++){
objs[i-1] = rs.getObject(i);
Element ele = new Element("xml");
ele.setText(objs[i-1]+"");
element.addContent(ele);
}
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
doc.addContent(element) ;
XMLOutputter out = new XMLOutputter() ;
Format mat = Format.getCompactFormat() ;
out .setFormat(mat);
try {
out.output(doc,new FileOutputStream("数据导出.xml"));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JOptionPane.showMessageDialog(null, "设置成功!!");
System.out.println("脱机导出");