DataEnthusiastic
DataEnthusiastic

Reputation: 63

XML document not well formed

I am not sure why I am getting "The markup in the document following the root element must be well formed". I was trying to use the following code in mainxml under res/menu in an android project. Plese help!!!

<?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" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical|left"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                style="@style/inputLabel"
                android:text="@string/cardHolderName" />

            <EditText
                android:id="@+id/cardHolderNameInput"
                style="@style/textInput"
                android:layout_width="fill_parent"
                android:singleLine="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                style="@style/inputLabel"
                android:text="@string/cardNumber" />

            <EditText
                android:id="@+id/cardNumberInput"
                style="@style/textInput"
                android:layout_width="fill_parent"
                android:numeric="integer"
                android:singleLine="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                style="@style/inputLabel"
                android:paddingRight="40sp"
                android:text="@string/expirationDate" />

            <TextView
                style="@style/inputLabel"
                android:text="@string/expirationMonth" />

            <EditText
                android:id="@+id/expirationMonthInput"
                style="@style/textInput"
                android:layout_width="50sp"
                android:numeric="integer"
                android:singleLine="true" />

            <TextView
                style="@style/inputLabel"
                android:paddingLeft="10sp"
                android:text="@string/expirationYear" />

            <EditText
                android:id="@+id/expirationYearInput"
                style="@style/textInput"
                android:layout_width="50sp"
                android:numeric="integer"
                android:singleLine="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                style="@style/inputLabel"
                android:text="@string/cvv" />

            <EditText
                android:id="@+id/cvvInput"
                style="@style/textInput"
                android:layout_width="fill_parent"
                android:numeric="integer"
                android:singleLine="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                style="@style/inputLabel"
                android:text="@string/amount" />

            <EditText
                android:id="@+id/amountInput"
                style="@style/textInput"
                android:layout_width="fill_parent"
                android:numeric="integer|decimal"
                android:singleLine="true" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/submitAction"
                style="@style/action"
                android:clickable="true"
                android:text="@string/submit" />
        </LinearLayout>
    </LinearLayout>

</ScrollView>

Any help will be appreciated. Thanks.

Upvotes: 0

Views: 189

Answers (2)

nedaRM
nedaRM

Reputation: 1827

You can't have a layout file under res/menu. Move the main.xml file to res/layout and it should be fine.

Upvotes: 4

Ryan S
Ryan S

Reputation: 4567

Most likely you have unclosed elements or haven't included the android namespace. Please post the entire xml doc for further clarification.

Edit: You have placed your xml under menu instead of under layout.

Upvotes: 1

Related Questions