您的位置:首页 > 移动开发 > Android开发

android 使用Sax 读取xml

2012-07-12 00:40 316 查看
Sax 读取xml ,读取较快,最重要的是占用内存较少.

为了防止自己遗忘.留下我今天的足迹.也供大家参考.如果有误.请指正.

首先 在src 根目录下面创建一个Person.xml 文件.里面添加内容:

1.Person.xml

View Code

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sax_xml"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- 加入下面这句  -->
<uses-library android:name="android.test.runner" />
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
......
</activity>
</application>
<!-- 加入下面这句  -->
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.example.sax_xml" android:label="Tests for My App" />
</manifest>


运行结果:



读取成功.

源码:http://files.cnblogs.com/xyong/Sax_Xml.rar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: