資源描述:
《輕松使用sax解析xml》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、sax方式解析xml的優(yōu)點:??????????只要有jdk的存在,嚴格意義上來說是jre,它就可以運行,不依賴任何第三方的jar包。在移動設(shè)備上尤為廣泛使用。比如Android就使用它來解析xml。當然Android更為推薦的是采用xmlpull來解析xml。這種方式也同樣適合javase。我在后期會為大家準備使用xmlpull解析xml的demo。敬請關(guān)注。??????????xml文件:????2、d="1"?group="1">????????張三????????男????????18????????zhangsan@163.com????????1987-06-08????????好學生????
????????????李四???????
3、?女????????18????????lisi@163.com????????1987-06-08????????好學生????????????????小王????????男????????18????????x
4、iaowang@163.com????????1987-06-08????????好學生????????????????小張????????男????????18????????xiaozhang@163.com????????1987
5、-06-08????????好學生????????????????小明????????男????????18????????xiaoming@163.com????????1987-06-08????????好學生????<
6、/student>????xml對應(yīng)的Javabean:package?com.parsexml.entity;public?class?Student?{????????private?int?id;????private?int?group;????private?String?name;????private?String?sex;????private?int?age;????private?String?email;????private?String?memo;????privat
7、e?String?birthday;????public?int?getId()?{????????return?id;????}????public?void?setId(int?id)?{????????this.id?=?id;????}????public?int?getGroup()?{????????return?group;????}????public?void?setGroup(int?group)?{????????this.group?=?group;????}????public?S
8、tring?getName()?{????????return?name;????}????public?void?setName(String?name)?{????????this.name?=?name;????}????public?String?getSex()?{????????return?sex;????}????public?void?setSex(String?sex)?{????????th