Tony Mathew
Tony Mathew

Reputation: 191

Error:(143) Error parsing XML: not well-formed (invalid token)

I get this error only when I set the button text as "<< Previous" or "Next >>".
The interesting thing is that no error is shown when I set "<< Previous" as button text in a particular xml.
I have attached both the XML files:

XML File that shows error:

<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:background="@drawable/background111"
tools:context=".Register_Page2">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_gravity="center"
    android:fillViewport="true"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingBottom="30dp"
        android:paddingLeft="20dp"
        android:paddingRight="20dp">


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_marginTop="20dp"
            android:text="* Required"
            android:textColor="@color/Item_Red"></TextView>

        <RelativeLayout
            android:id="@+id/relativelayout_q1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/q4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="Have you completed an IELTS examination? *"
                android:textColor="@color/black"
                android:textSize="23dp"></TextView>

            <RadioGroup
                android:id="@+id/radioGroup4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/q4"
                android:layout_marginTop="10dp">

                <RadioButton
                    android:id="@+id/radio_q4_1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="YES" />

                <RadioButton
                    android:id="@+id/radio_q4_2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="NO" />

                <RadioButton
                    android:id="@+id/radio_q4_3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="CURRENTLY TRAINING FOR THE IELTS EXAM" />

            </RadioGroup>
        </RelativeLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:background="@android:color/darker_gray" />

        <RelativeLayout
            android:id="@+id/relativelayout_q2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/q5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="Do you have a Graduate Degree or Master's Diploma? *"
                android:textColor="@color/black"
                android:textSize="23dp"></TextView>

            <RadioGroup
                android:id="@+id/radioGroup5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/q5"
                android:layout_marginTop="10dp">

                <RadioButton
                    android:id="@+id/radio_q5_1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="YES" />

                <RadioButton
                    android:id="@+id/radio_q5_2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="NO" />

                <RadioButton
                    android:id="@+id/radio_q5_3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="IN PROCESS" />

                <RadioButton
                    android:id="@+id/radio_q5_4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="JUST GRADUATED" />

            </RadioGroup>
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp">

            <Button
                android:id="@+id/Previous2"
                style="?attr/borderlessButtonStyle"
                android:layout_width="100dp"
                android:layout_height="50dp"
                android:layout_alignParentLeft="true"
                android:text="<<Previous"
                android:textAllCaps="false"
                android:textColor="#ffffff" />

            <Button
                android:id="@+id/Next2"
                style="?attr/borderlessButtonStyle"
                android:layout_width="100dp"
                android:layout_height="50dp"
                android:layout_alignParentRight="true"
                android:text="Next>>"
                android:textAllCaps="false"
                android:textColor="#ffffff" />
        </RelativeLayout>


    </LinearLayout>
</ScrollView>

XML File which does not show the error:

<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:background="@drawable/background111"
tools:context=".Register_Page1">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_gravity="center"
    android:fillViewport="true"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"
        android:paddingBottom="30dp"
        android:paddingLeft="20dp"
        android:paddingRight="20dp">

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/t1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="center"
                android:padding="5dp"
                android:text="Elite English Club Entry Assessment Form"
                android:textColor="@color/black"
                android:textSize="38dp"
                android:typeface="sans" />

            <TextView
                android:id="@+id/t2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/t1"
                android:gravity="center_horizontal"
                android:text="This is our Form for students who are interested in joining our Elite English Club."></TextView>
            >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/t2"
                android:layout_gravity="left"
                android:layout_marginTop="20dp"
                android:text="* Required"
                android:textColor="@color/Item_Red"></TextView>>
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/usernameWrapper"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp">

                <EditText
                    android:id="@+id/Name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:ems="10"
                    android:hint="What's your name? *"
                    android:inputType="textPersonName"
                    android:textColorHighlight="#fff" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/englishlevelWrapper"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/usernameWrapper"
                android:layout_marginTop="10dp">

                <EditText
                    android:id="@+id/English_Level"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginTop="10dp"
                    android:ems="10"
                    android:hint="What is your english level? *"
                    android:inputType="textMultiLine" />
            </android.support.design.widget.TextInputLayout>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/reasonsWrapper"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/englishlevelWrapper"
                android:layout_marginTop="10dp">

                <EditText
                    android:id="@+id/Reasons"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginTop="10dp"
                    android:ems="10"
                    android:hint="Reasons for improving  your English*"
                    android:inputType="textMultiLine" />
            </android.support.design.widget.TextInputLayout>


        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp">


            <Button
                android:id="@+id/Next1"
                android:layout_width="100dp"
                android:layout_height="50dp"
                android:layout_alignParentRight="true"
                style="?attr/borderlessButtonStyle"
                android:textColor="#ffffff"
                android:text="Next>>"
                android:textAllCaps="false" />
        </RelativeLayout>

    </LinearLayout>

</ScrollView>

Upvotes: 1

Views: 783

Answers (2)

Ganesh Pokale
Ganesh Pokale

Reputation: 1594

Try this code

           <Button
            android:id="@+id/Previous2"
            style="?attr/borderlessButtonStyle"
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:layout_alignParentLeft="true"
            android:text="&lt;&lt; Previous"
            android:textAllCaps="false"
            android:textColor="#ffffff" />

         <Button
            android:id="@+id/next"
            style="?attr/borderlessButtonStyle"
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:layout_alignParentLeft="true"
            android:text="Next &gt;&gt;"
            android:textAllCaps="false"
            android:textColor="#ffffff" />

Upvotes: 1

xenteros
xenteros

Reputation: 15842

Characters < and > need to be escaped in xml files.

You can escape < with &lt; or &#60; and > with &gt; or &#62;.

Upvotes: 1

Related Questions