XStreamのjarパッケージを使用
x-stream.github.io/index.html
jarパッケージはクラス
public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; public Person(String firstname,String lastname){ this.firstname = firstname; this.lastname = lastname; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public PhoneNumber getPhone() { return phone; } public void setPhone(PhoneNumber phone) { this.phone = phone; } public PhoneNumber getFax() { return fax; } public void setFax(PhoneNumber fax) { this.fax = fax; } } public class PhoneNumber { private int code; private String number; public PhoneNumber(int code,String number){ this.code = code; this.number = number; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } }
以上がJavaBeanとXMLの相互変換ツールクラスの詳細な紹介の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。