XML:结尾部分不允许有内容 [英] XML: content is not allowed in trailing section

查看:33
本文介绍了XML:结尾部分不允许有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到这些错误

<前>在这一行找到多个注释:- 错误:解析 XML 时出错:格式不正确(令牌无效)- 结尾部分不允许有内容.

在这个 XML 文件上...

<项目机器人:state_enabled =假"android:drawable="@drawable/btn_red"/><项目机器人:state_pressed =真"机器人:state_enabled =真"android:drawable="@drawable/btn_orange"/><项目机器人:state_focused =真"机器人:state_enabled =真"android:drawable="@drawable/btn_orange"/><项目机器人:state_enabled =真"android:drawable="@drawable/btn_black"/></选择器>

对于了解 XML 的人来说可能非常简单.有什么想法吗?

解决方案

如果您从链接到的站点粘贴它,则有两个小连字符是您不想要的.一个在 结束之后,一个在第一个 之前.摆脱这些,一切都会好起来的.

I'm getting these errors

Multiple annotations found at this line:
    - error: Error parsing XML: not well-formed 
     (invalid token)
    - Content is not allowed in trailing section.

on this XML file...

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item 
    android:state_enabled="false"
        android:drawable="@drawable/btn_red" />
    <item 
        android:state_pressed="true" 
        android:state_enabled="true"
        android:drawable="@drawable/btn_orange" />
    <item 
        android:state_focused="true" 
        android:state_enabled="true"
        android:drawable="@drawable/btn_orange" />
    <item 
        android:state_enabled="true"
        android:drawable="@drawable/btn_black" />
</selector>

Probably quite simple for you people who know XML. Any idea?

解决方案

If you pasted it from the site you link to, there are two little hyphens you don't want. One after the close of </selector> and one just before the first <item>. Get rid of those, and all will be well.

这篇关于XML:结尾部分不允许有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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