• Error parsing XML: junk after document element java程序员


    今天开始接触android的Java编程,出现问题了。

    我的代码是这样的:

    <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="horizontal"
        tools:context=".MainActivity" >

    </LinearLayout>

    <EditText android:id="@+id/edit_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message"/>
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" />

    应该把</LinearLayout>放在最后一行。

    原因:

    这里Android123提示大家一般合法的XML文件只有一个主根节点,比如

    <android123>
        <item1/>
        <item2/>
        <item3/>
    </android123>

    如果出现了Error parsing XML: junk after document element这样的错误,你的想法可能只要主根有多个节点,比如说

     <android123>
        <item1/>
    </android123>
    <android123>
        <item2/>
        <item3/>
    </android123>


  • 相关阅读:
    WebApi实现自定义错误日志
    WebApi实现IHttpControllerSelector问题
    动态属性ExpandoObject
    SQL远程连接
    HTML空格占位
    SQL生僻字模糊查询
    python中的字符串
    idea闪退
    lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
    linux下后台启动weblogic
  • 原文地址:https://www.cnblogs.com/java20130725/p/3215471.html
Copyright © 2020-2023  润新知