错误:“解析XML时出错:XML或文本声明不在实体开始处” [英] Error: "Error parsing XML: XML or text declaration not at start of entity"

查看:115
本文介绍了错误:“解析XML时出错:XML或文本声明不在实体开始处”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个Sudoku Android应用程序,并且在main.xml下收到以下错误:错误:解析XML时出错:XML或文本声明不在实体开始处任何帮助将不胜感激。这是我的代码。我在错误旁边放了'✗'

I am making a Sudoku Android app and I am getting the following errors under main.xml: "error: Error parsing XML: XML or text declaration not at start of entity" Any help would be appreciated. Here is my code. I put '✗' next to the error

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

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@String/continue_label"/>

        <Button
            android:id="@+id/continue_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/continue_label" />

        <Button
            android:id="@+id/new_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/new_game_label"/>

        <Button 
            android:id="@+id/about_button"
            android:layout_Width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/new_game_label"/>

        <Button
            android:id="@+id/exit_button"
            android:layout_Width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/exit_label"/>
    </LinearLayout>

`

推荐答案

可能有两种情况-

情况1-如果在第一条语句前有空格。

case 1 - If you have an empty space before the first statement.

情况2-如果您不小心两次输入了相同的namepacing语句,即-?xml version = 1.0 encoding = utf-8?

case 2 - If you have accidently put the same namespacing statement twice ie - ?xml version="1.0" encoding="utf-8"?

我做了一次,并在更正它后遇到了与您相同的错误,我的代码运行正常。希望对您有帮助

I did it once and landed with the same error of yours after correcting it my code runs fine. hope this helps

这篇关于错误:“解析XML时出错:XML或文本声明不在实体开始处”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆