快捷搜索:  as  xxx  test  www.ymwears.cn  as aNd 8=8

轻松使用xmlpull解析xml

在上文中先容了应用sax要领解析xml,这里先容下在Android中逝世力保举的xmlpull要领解析xml。xmlpull不仅仅可以应用在Android上,同样也适用于javase,但在javase情况下,你必要自己去获取xmlpull所依附的类库。

情况:

kxml2-2.3.0.jar

xmlpull_1_1_3_4c.jar

以上两个jar分手从以下网站下载:

http://www.xmlpull.org/xmlpull

http://kxml.sourceforge.net/kxml

xml文件:

xml version="1.0" encoding="UTF-8"?>

root>

student id="1" group="1">

name>张三name>

sex>男sex>

age>18age>

email>zhangsan@163.comemail>

birthday>1987-06-08birthday>

memo>勤门生memo>

student>

student id="2" group="2">

name>李四name>

sex>女sex>

age>18age>

email>lisi@163.comemail>

birthday>1987-06-08birthday>

memo>勤门生memo>

student>

student id="3" group="3">

name>小王name>

sex>男sex>

age>18age>

email>xiaowang@163.comemail>

birthday>1987-06-08birthday>

memo>勤门生memo>

student>

student id="4" group="4">

name>小张name>

sex>男sex>

age>18age>

email>xiaozhang@163.comemail>

birthday>1987-06-08birthday>

memo>勤门生memo>

student>

student id="5" group="5">

name>小明name>

sex>男sex>

age>18age>

email>xiaoming@163.comemail>

birthday>1987-06-08birthday>

memo>勤门生memo>

student>

root>

您可能还会对下面的文章感兴趣: