#AndroidStudio插件之GsonOrXmlFormat**GsonOrXmlFormat**[下载链接](https://plugins.jetbrains.com/plugin/8435?pr=)首先,谈谈开发这个插件的原因。在做android 客户端获取服务器数据,采用当下流行json格式,但是也有很多还残留着xml字符串格式,对于后台返回的xml/json的字符串不得不自己手动编写json/xml格式->bean 类。这个过程是枯燥而且乏味,有时候还容易出错,所以希望GsonOrXmlFormat帮你完成json/xml ->bean类的生成(quickly to convert a JSON string or XML string to an entity class)。提高开发效率.**首先要感谢dim轻微的GsonFormat**[描述](https://plugins.jetbrains.com/plugin/7654?pr=)**基于GsonFormat 集成了xml格式一>bean类**如何使用该插件呢**1.接下是安装插件,然后restart。**>![Alt text](./YY2WY_CC7$V8K2N]DZR5QV.jpg)>![Alt text](./KR647D7O_KF~ZZH@V}7X63.jpg)**2.使用插件,在弄的里面,点击右键Generate->GsonOrXmlFormat**>![Alt text](./VL5FL3NOIJB`CET7Q38G]B.jpg)>![Alt text](./IUEG4MXC5G6DZ$1H@{NS.png)>>把xml报文黏贴进去如下图:>![Alt text](./G3][{ZTC_}5HCHQ03O_RM.png)**3.效果**>![Alt text](./_AH@7O2YD~}OI55B}Q.jpg)>**生成的bean类如下**“`public class Test {/*** employee : {“sex”:”m”,”name”:”ddviplinux”,”age”:30}*/private EmployeesBean employees;public EmployeesBean getEmployees() {return employees;}public void setEmployees(EmployeesBean employees) {this.employees = employees;}public static class EmployeesBean {/*** sex : m* name : ddviplinux* age : 30*/private EmployeeBean employee;public EmployeeBean getEmployee() {return employee;}public void setEmployee(EmployeeBean employee) {this.employee = employee;}public static class EmployeeBean {private String sex;private String name;private int age;public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}}}}“`