java解析XML映射成对象实体
使用JDK自带的
1.创建一个XML文件:config.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <root > 3 4 <section target="system_user" description="用户信息" relation="" sourceIdentityColumn="id" targetIdentityColumn="source_id" isEnabled="true"> 5 <table source="system_sync_pre_school_student" description="幼儿园学生信息" condition="" isEnabled="true"> 6 <column source="id" target="source_id" type="STRING" description="源数据与目标数据的对应值" filter="" replace="" isEnabled="true"/> 7 <column source="name" target="name" type="STRING" description="姓名" filter="" replace="" isEnabled="true"/> 8 <column source="sex" target="sex" type="STRING" description="性别" filter="" replace="男=1,女=0" isEnabled="true"/> 9 <column source="student_id" target="open_id" type="STRING" description="用户唯一openId" filter="" replace="" isEnabled="true"/> 10 11 </table> 12 </section> 13 14 <section target="system_user" description="用户信息" relation="" sourceIdentityColumn="id" targetIdentityColumn="source_id" isEnabled="true"> 15 <table source="system_sync_pre_school_student" description="幼儿园学生信息" condition="" isEnabled="true"> 16 <column source="id" target="source_id" type="STRING" description="源数据与目标数据的对应值" filter="" replace="" isEnabled="true"/> 17 <column source="name" target="name" type="STRING" description="姓名" filter="" replace="" isEnabled="true"/> 18 <column source="sex" target="sex" type="STRING" description="性别" filter="" replace="男=1,女=0" isEnabled="true"/> 19 <column source="student_id" target="open_id" type="STRING" description="用户唯一openId" filter="" replace="" isEnabled="true"/> 20 </table> 21 </section> 22 23 </root>