Android中Sax解析与Dom解析xml文件
2013-05-30 20:52:59 来源:WEB开发网核心提示:-<?xml version="1.0" encoding="utf-8"?><resources> <string name="app_name">day03-xml</string> <st
-------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">day03-xml</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="btn_sax">采用sax解析</string>
<string name="btn_dom">采用Dom解析xml</string>
<string name="btn_pull">采用pull解析xml</string>
</resources>
<resources>
<string name="app_name">day03-xml</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="btn_sax">采用sax解析</string>
<string name="btn_dom">采用Dom解析xml</string>
<string name="btn_pull">采用pull解析xml</string>
</resources>
----------------------------------------------------------------------------------------------------------------------
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/btn_sax"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
android:text="@string/btn_sax" />
<Button
android:id="@+id/btn_dom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_sax"
android:layout_alignRight="@+id/btn_sax"
android:layout_below="@+id/btn_sax"
android:layout_marginTop="65dp"
android:text="@string/btn_dom" />
<Button
android:id="@+id/btn_pull"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_dom"
android:layout_alignRight="@+id/btn_dom"
android:layout_below="@+id/btn_dom"
android:layout_marginTop="69dp"
android:text="@string/btn_pull" />
</RelativeLayout>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/btn_sax"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
android:text="@string/btn_sax" />
<Button
android:id="@+id/btn_dom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_sax"
android:layout_alignRight="@+id/btn_sax"
android:layout_below="@+id/btn_sax"
android:layout_marginTop="65dp"
android:text="@string/btn_dom" />
<Button
android:id="@+id/btn_pull"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_dom"
android:layout_alignRight="@+id/btn_dom"
android:layout_below="@+id/btn_dom"
android:layout_marginTop="69dp"
android:text="@string/btn_pull" />
</RelativeLayout>
更多精彩
赞助商链接