1
我希望你能幫助我。正如我可以涉及一個類,兩個不同的文件與jaxb
目前我收到xml
格式的兩個文件,我想知道如何使用jaxb
將這兩個文件關聯到同一個類。
Company.xml
<?xml version="1.0" encoding="utf-8"?>
</records>
<record>
<id>4<id>
<companyName>B</companyName>
......
</record>
<record>
<id>7<id>
<companyName>B</companyName>
......
</record>
</records>
Employees.xml
<?xml version="1.0" encoding="utf-8"?>
<records>
<record>
<EmployeeName>AA</EmployeeName>
<CompanyID>2</CompanyID>
</record>
<record>
<EmployeeName>AB</EmployeeName>
<CompanyID>2</CompanyID>
</record>
</records>
我想知道我怎麼能產生涉及這些領域的ID公司
public class Companys{
private List<Company> list;
}
public class Company{
private String companyName;
private Integer id;
.........
//I need use JaxB --reference ID company
private List<Employees> list;
}
public class Employee{
private String Name;
private Integer idCompany;
.......................
}
內的方法討論了許多次:http://stackoverflow.com/questions/11128191/jaxb-unmarshalling-xml-with-multiple-名字換了,同樣的元素 – Andremoniy