1

Имеется xml файл:

<menu xmlns:android="http://schemas.android.com/apk/res/android"></menu>

//Выдается ошибка: The processing instruction target matching "[xX][mM][lL]" is not allowed.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    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:orientation="vertical"
    android:padding="5dp">
    <TextView
        android:id="@+id/tvTitleGPS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/provider_gps"
        android:textSize="30sp">
    </TextView>
    <TextView
        android:id="@+id/tvEnabledGPS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <TextView
        android:id="@+id/tvStatusGPS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <TextView
        android:id="@+id/tvLocationGPS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <TextView
        android:id="@+id/tvTitleNet"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/provider_network"
        android:textSize="30sp">
    </TextView>
    <TextView
        android:id="@+id/tvEnabledNet"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <TextView
        android:id="@+id/tvStatusNet"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <TextView
        android:id="@+id/tvLocationNet"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp">
    </TextView>
    <Button
        android:id="@+id/btnLocationSettings"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:onClick="onClickLocationSettings"
        android:text="@string/location_settings">
    </Button>
</LinearLayout>
<menu xmlns:android="http://schemas.android.com/apk/res/android"></menu>

//А тут: error: Error parsing XML: junk after document element

После компиляции:

error: Error parsing XML: junk after document element

В чем причина и как можно исправить?

4
  • У вас не закрыт головной тэг. Добавьте в конце файла строчку </LinearLayout>
    – Deft
    3 авг 2017 в 7:49
  • 2
    Кривого форматирования кода оригинального вопроса пораждает ещё больше вопросов. Думаю, что имелась ввиду именно такая версия xml файла.
    – eugeneek
    3 авг 2017 в 9:37
  • 1
    Что вы пытались сделать в этом файле, меню или разметку layout?
    – eugeneek
    3 авг 2017 в 9:39
  • У вас два корневых тэга, <LinearLayout> и <menu> В XML это запрещено — корневой тег должен быть один. 27 фев 2018 в 8:23

1 ответ 1

3

Уберите в конце строчку

<menu xmlns:android="http://schemas.android.com/apk/res/android"></menu>
1
  • И в начале тоже.
    – eugeneek
    3 авг 2017 в 9:38

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.