错误的解析XML:没有找到元素 [英] Error parsing XML: no element found

查看:1089
本文介绍了错误的解析XML:没有找到元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先原谅我,如果我发布了这个问题错了。我用计算器对于很多问题,但这是我第一次想不出已经找到一个答案我的问题。所以,如果我做错了,请让我知道,我会重新发布/编辑的问题。

现在你们的业务。我最近刚刚开始发展瓦特/ Android SDK中,我从以下<一个基本教程href=\"http://developer.android.com/resources/tutorials/hello-world.html#avd\">http://developer.android.com/resources/tutorials/hello-world.html#avd
我已经得到了XML编辑工作的一部分,当我使所有更改的XML文件的main.xml和strings.xml中出现此错误。此外,当我编译项目,编译过程生成一个main.out.xml文件是空的。我不知道它是什么或它的目的。

错误:


  

[2011-12-30 16点10分02秒 - 你好剃刀] RES \\布局\\ main.xml中0:错误:资源进入主已定义。
  [2011-12-30 16点10分02秒 - 你好剃刀] RES \\布局\\ main.out.xml 0:这里最初定义。
  [2011-12-30 16点10分02秒 - 你好剃刀] C:\\用户\\ Dux69 \\工作区\\你好刀片\\水库\\布局\\ main.out.xml:1:错误:错误解析XML:没有找到元素
  [2011-12-30 16点10分13秒 - 你好剃刀]错误在一个XML文件:中止建设


我的项目是用于设置的平台:Android的2.3.3 API等级:10

我不知道这是否有差别或没有,但我用我的Andr​​oid难以置信的运行/调试应用程序不是一个Android虚拟设备。如果有任何需要了解更多信息,让我知道,我会尽快发布它。

下面是我用三个code文件:

main.xml中

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT; TextView中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / TextView的
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直
机器人:文字=@字符串/ hello_O/&GT;

的strings.xml

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT;资源&GT;
&LT;字符串名称=hello_O&GT;巴巴的房子,剃刀活性LT;!/串&GT;
&LT;字符串名称=APP_NAME&GT;您好剃刀应用&LT; /串&GT;
&LT; /资源&GT;

razorActivity.java

 包hello.Razor;进口android.R;
进口android.app.Activity;
进口android.os.Bundle;    公共类razorActivity扩展活动
    {
        / **当第一次创建活动调用。 * /
        @覆盖
        公共无效的onCreate(捆绑savedInstanceState)
        {
           super.onCreate(savedInstanceState);
           的setContentView(R.layout.main);
        }
    }


解决方案

删除main.out.xml在项目视图和重新运行的Andr​​oid应用程序

First off forgive me if I posted this question wrong. I've used stackoverflow for many problems but this is the first time I couldnt already find an answer to my problem. So, if I'm doing something wrong please let me know and I'll repost / edit the question.

Now unto business. I've just recently started development w/ the Android SDK and I'm following the basic tutorial from http://developer.android.com/resources/tutorials/hello-world.html#avd I've gotten up the xml editting part and when I make all the changes to the xml files main.xml and strings.xml this error occurs. Also, when I compile the project, the compilation process generates a main.out.xml file that is empty. I don't know what it is or its purpose.

The error:

[2011-12-30 16:10:02 - Hello Razor] res\layout\main.xml:0: error: Resource entry main is already defined. [2011-12-30 16:10:02 - Hello Razor] res\layout\main.out.xml:0: Originally defined here. [2011-12-30 16:10:02 - Hello Razor] C:\Users\Dux69\workspace\Hello Razor\res\layout\main.out.xml:1: error: Error parsing XML: no element found [2011-12-30 16:10:13 - Hello Razor] Error in an XML file: aborting build.

My project is setup for platform: Android 2.3.3 API Level: 10

I don't know if it makes a difference or not but I'm using my Android Incredible for running/debugging the application not a Android Virtual Device. If there is any more information needed let me know and I'll post it ASAP.

Here are the three code files I'm using:

main.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
android:text="@string/hello_O" />

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello_O">Baba in the house, Razor Activity!</string>
<string name="app_name">Hello Razor App</string>
</resources>

razorActivity.java

package hello.Razor;

import android.R;
import android.app.Activity;
import android.os.Bundle;

    public class razorActivity extends Activity
    {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);
        }
    }

解决方案

delete the main.out.xml in project view and re-run as android application

这篇关于错误的解析XML:没有找到元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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