English 中文(简体)
Valid XML案在ADT中“未穿透”错误
原标题:Valid XML file gives "failed to parse" error in Android ADT

我提交了XML文件:

<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:state_pressed="true"
   android:drawable="@drawable/calender_h" />
  <item
   android:state_pressed="false"
  android:drawable="@drawable/calender_n" />  
</selector>

但它给我留下以下错误:

Failed to parse file G. 口头发言 esdrawablecalendar_selector.xml

问题是什么?

最佳回答

I m not sure it s the same, but Similar issue happened to me when updating to ADT 15, in a library project. this is the google issue that currently still opened: 21046.

这对我来说是有助益的:

  1. Remove the library declaration of the project.
  2. Open the layout causing the error (the one which using the selector) in graphical layout.
  3. Clean the project (Project -> Clean)
  4. Close and reopen eclipse. (the layout should be ok now)
  5. You can set the project as library again.

Hope this helps! (if it s still relevant...)

问题回答

You XML罚款。 你们是否失踪了。 清理项目一次。 如果你从某处复制,那么在《刑法》中可能有一些看不见的特殊性。

无论如何,看问题窗口。 它应向您提供更多有关错误的细节。

从Eclipse,右边点击Xml文档,选择开放式->XML编辑。 为此选择设计表格。 您可以注意到,在您的<条码>和代号;项目编号和编号; 之后,有个神秘的儿童要素。 右边点击并选择去除。

仅仅花了一个小时或这么多时间试图解决这一问题,这证明是固定的,可能有些无形的特性造成失败。 无论如何,希望能帮助任何有这一问题的人!

  1. Failed to parse XML file for android
  2. check that your drawables exist at the appropriate paths
  3. check for inivisible characters

4. I`ve also ran into the same problem. What I found is that each of the StateListDrawable states (pressed, selected, focused, etc.) actually expects a valid drawable (png, jpg, gif, etc.). So, that means, something like this will cause the parse error problem:

<item android:state_s selected=“true”/>

I also ran into this. The layout xml files and main.xml would not parse. if you chose the graphical view for main.xml you would not get any buttons (in my case). What i found is that Eclipse was set to C++ rather than java. Setting it to the java perspective, closing, then reopening Eclipse fixed the issue.

现在,Eclipse正在做其他奇怪的 st子,如间断连接电话。

我也存在同样的问题,这是由于一个资源图像的名称。 图像由一位设计师传给我,该设计师介绍了一些未被安乐接受的特性,甚至当我重新命名在Eclipse内时,显然还有一些“vil”。 Weird。

就我而言,这些可提取产品(PNG文件)被腐蚀,而将其从Windows机器转移到我确实发展起来的Windows机器。 我表示,试图打开巴布亚新几内亚的档案。 这些PNG档案无法打开,因为它们被腐败。

在再次移交他们后,该公司进行了罚款。





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签