博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Error parsing XML: junk after document element
阅读量:4648 次
发布时间:2019-06-09

本文共 935 字,大约阅读时间需要 3 分钟。

今天开始接触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>

转载于:https://www.cnblogs.com/java20130725/archive/2013/06/05/3215471.html

你可能感兴趣的文章
前端分页功能的实现以及原理
查看>>
标准差分进化算法matlab程序实现(转载)
查看>>
leetcode[163]Missing Ranges
查看>>
前端面试题集锦
查看>>
php遍历文本文档txt文件中的链接内容为数组
查看>>
微信小程序
查看>>
C语言数据类型作业
查看>>
Android学习--还有一些小技巧
查看>>
sql日期格式处理
查看>>
aliyun阿里云Maven仓库地址——加速你的maven构建
查看>>
Windows Service Application Overview
查看>>
Python中布尔类型
查看>>
几个常用方法有效优化ASP.NET的性能
查看>>
【HANA系列】SAP HANA XS创建XSJOB后台执行
查看>>
linux下 apache启动、停止、重启命令
查看>>
利用并查集判断一个无向图是否成树
查看>>
JS面向对象的实现和原理
查看>>
Linux系统中常用操作命令
查看>>
针对模拟滚动条插件(jQuery.slimscroll.js)的修改
查看>>
poi实现excel数据导入数据库
查看>>