½ÉÇÃÇÁ·¹ÀÓ¿öÅ© *.jar µî·Ï
package bean;
import org.simpleframework.xml.*;
/**
*
* @author KB_Mr2
*/
@Root
public class KB_bean {
@Attribute
private String type;
@Element
private String company;
@Element
private String id;
@Element
private int quantityInStock;
@Element
private String model;
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* @return the company
*/
public String getCompany() {
return company;
}
/**
* @param company the company to set
*/
public void setCompany(String company) {
this.company = company;
}
/**
* @return the quantityInStock
*/
public int getQuantityInStock() {
return quantityInStock;
}
/**
* @param quantityInStock the quantityInStock to set
*/
public void setQuantityInStock(int quantityInStock) {
this.quantityInStock = quantityInStock;
}
/**
* @return the model
*/
public String getModel() {
return model;
}
/**
* @param model the model to set
*/
public void setModel(String model) {
this.model = model;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
}
//¸ÞÀÎ ºÎºÐ ó¸®
package kb_xml_parsing;
import bean.KB_bean;
import java.io.File;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
/**
*
* @author KB_Mr2
*/
public class KB_Xml_Parsing {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try{
Serializer serializer = new Persister();
KB_bean kb = new KB_bean();
kb.setCompany("¹«¶óµ¿");
kb.setModel("ÁýÁý½º");
kb.setId("kill");
kb.setType("´©¶ó½º");
kb.setQuantityInStock(23);
File file = new File("kb1.xml");
serializer.write(kb, file);
}catch (Exception e){
e.printStackTrace();
}
System.out.print("À¯´ÏƼ Â¥Áõ³ª __");
}
}
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)