how to compare the two xml files and update the one xml file in java?

Posted by prasad.gai on Stack Overflow See other posts from Stack Overflow or by prasad.gai
Published on 2012-03-27T04:44:22Z Indexed on 2012/03/27 5:30 UTC
Read the original article Hit count: 384

Filed under:
|
|
|

I have created two xml files from those xml file i would like to compare one xml file with another xml file and update the xml file.

I have created an xml file as follows:

main.xml

       <?xml version="1.0" encoding="utf-8"?>
       <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" 
       android:background="#00BFFF"> 
       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">

    <LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:gravity="center"      android:visibility="visible">
</LinearLayout>
<LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:gravity="center"  android:visibility="visible">

</LinearLayout>

 </LinearLayout>
   </ScrollView>

properties.xml

   <?xml version='1.0' encoding='utf-8' standalone='yes' ?>
    <map>
    <int name="linearLayout1" value="8" />
    <int name="linearLayout2" value="0" />
    </map>

from the above two xml files i would like to compare with LinearLayout android:id ="@id/LinearLayout1" from main.xml with int name ="linearLayout1" from properties.xml. from the above properties.xml file where name ="linearLayout1" and value ="8" then i would like to update the main.xml file where as LinearLayout android:id="@id/linearLayout1" propertie value as android:visibility="gone"

From the above xml file how can i update main.xml file by comparing properties.xml? please any body help me.....

© Stack Overflow or respective owner

Related posts about java

Related posts about android