import org.dom4j.Element; import java.io.Serializable; public class SelectionBody extends Body { /** serialVersionUID */ private static final long serialVersionUID = -6826872985549264823L; /** CODE */ private String code; /** 类型 */ private String type; /** 等级 */ private String level; /* * 将XML文档对象转换成业务对象 */ @Override public void fromXml(Element element) { if (element != null) { Element condition = element.element("Condition"); if (condition != null) { code = condition.attributeValue("Code"); type = condition.attributeValue("Type"); } } super.fromXml(element); } /* * 将业务对象转换成XML文档对象 */ @Override public Element toXml(Element element) { if (element != null) { Element condition = element.addElement("Conditon"); condition.addAttribute("Code", code != null ? code : ""); condition.addAttribute("Type", type != null ? type : ""); } return super.toXml(element); } }
-----------------------------------------------------------------------------