XMLBeansXML-Java绑定工具
XMLBeans是一个XML-Java绑定工具,利用它可以很方便地解析XML文档。
Eclipse支持插件:xmlbeansplug(在线更新地址)。
下面是一段使用 XMLBeans 的代码:
File xmlFile = new File("c:\employees.xml"); 
// Bind the instance to the generated XMLBeans types.
EmployeesDocument empDoc = 
	EmployeesDocument.Factory.parse(xmlFile); 
// Get and print pieces of the XML instance.
Employees emps = empDoc.getEmployees(); 
Employee[] empArray = emps.getEmployeeArray(); 
for (int i = 0; i < empArray.length; i++) 
{ 
	System.out.println(empArray[i]); 
} 
在线Javadoc:http://www.ostools.net/apidocs/apidoc?api=xmlbeans
评论
