登录
首页 » Android » Android解析XML文件的例子

Android解析XML文件的例子

于 2022-04-11 发布 文件大小:14.37 kB
0 175
下载积分: 2 下载次数: 1

代码说明:

Android解析XML文件的例子,在运行后的窗口中,单击解析XML文件后,会按照格式读取出Xml数据,以一定格式显示出来,如示例图所示的效果,实现代码可参考如下:   //xml没到最后 做循环   while(xpr.getEventType() != XmlResourceParser.END_DOCUMENT){   if(xpr.getEventType() == XmlResourceParser.START_TAG){    //获取标签的标签名    String name = xpr.getName();    if(name.equals("book")){    sb.append("价格:" + xpr.getAttributeValue(null, "price"));    sb.append("出版日期:"+ xpr.getAttributeValue(1));    try {    sb.append("书名:" + xpr.nextText());    } catch (IOException e) {    // TODO Auto-generated catch block    e.printStackTrace();    }    }   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 移动textview位置后保存移动后的位置
    移动textview位置后保存移动后的位置,只是个demo,自己测试过,没有报错之类的。试运行在2.3和4.0.3版本的设备,其他的未进行测试。
    2022-03-24 10:05:14下载
    积分:1
  • imiFirewall
    手机安全防火墙源码是一套比较全面的安卓手机安全方面的源码,总结起来就是三大防火墙电话防火墙、短信防火墙和网络防火墙和一些零碎的小工具。网络防火墙有流量预警功能,可以设置2G3G和wifi的数据流量和显示流量统计。小工具有android的命令行工具,测试了一下可以使用一些简单的liunx命令。还有一个超级终端功能。任务管理器可以结束进程和查看进程的通话防火墙支持通话黑白名单,可以选择电话被拒接以后的回复语、短信防火墙跟电话防火墙功能差不多。(Mobile security firewall source code is a more comprehensive Android mobile phone safety aspects of the source code, to sum up is three firewall phone firewall, SMS firewall and network firewall and some fragmentary gadget. Network firewall has traffic warning function, you can set the 2G3G and WiFi data flow and display traffic statistics. As a command line tool with Android, you can use some simple liunx command test. There is also a super terminal function. Task manager to end of the process and check process call firewall support call black and white list, can choose the telephone was refused to reply, SMS firewall with phone firewall functions in a similar way.)
    2016-07-21 11:41:57下载
    积分:1
  • Plane_war_game
    基于android的飞机大战游戏,不过不能触屏控制,只能通过DAPD板控制上下左右,对初学者有用(Plane war game based on android, but can t touch screen control, only through DAPD board to control the up and down or so, useful for beginners)
    2013-12-07 21:49:44下载
    积分:1
  • 实现android相册网格和gallery功能 实例源码下载
    实现android相册网格和gallery功能 实例源码下载
    2015-03-17下载
    积分:1
  • LightingColorFilter_Delegate
    Delegate implementing the native methods of android.graphics.LightingColorFilter.
    2013-12-16 10:58:46下载
    积分:1
  • 简单的popmenu
    简单的popmenu
    2015-08-29下载
    积分:1
  • WifiDisplaySink
    WifiDisplaySink
    2021-05-06下载
    积分:1
  • 仿微信小视频
    应用背景android 仿微信小视频,现在的软件越来越注重应用,小视频功能已经越来越受大家的欢迎。关键技术mediaRecorder,VideoView,android,timer,activity,manifest
    2023-08-13 15:55:04下载
    积分:1
  • mvvm
    mvvm模式,使用泛型的方式,避免创建多个接口
    2023-06-06 01:05:03下载
    积分:1
  • 51单片机红外遥控循迹避障实验源代码
    51单片机红外遥控循迹避障实验源代码
    2020-12-09下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载