Parse android xml views
ayodelekehinde opened this issue · comments
Ayodele Kehinde commented
I tired parsing android layout XML, but it didnt maintain hierarchy
Arnaud Guyon commented
hi!
could you please attach the XML file you tried so that I can have a look?
thanks!
Ayodele Kehinde commented
Try parse this:
<TextView
android:id="@+id/txt_hello"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello world" />
<TextView
android:id="@+id/txt_hello"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello world" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_hello"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello world" />
<TextView
android:id="@+id/txt_hello"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello world" />
</LinearLayout>
Arnaud Guyon commented
Hi,
in xml format there must be 1 root element containing all the others. For example a at the top of the file and at the bottom. Otherwise the xml is not valid.
Arnaud.