XML: content is not allowed in trailing section

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=""> <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?

4

5 Answers

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.

2
<resources> <string name="app_name">Test App</string> </resources> testData("test"); 

If in any xml file unfortunately this type of line is remaining then this error is occur.

Do you have any extraneous characters after the closing tag (I'm assuming what you posted is just an excerpt from the file, since it obviously won't work without at least a closing tag)?

1

This happened to me as well after multiple modifications on the file, I just cut out the content and pasted to Notepad++ (to remove any formatting). Saved my empty .xml file and closed the project. Reopened the project and put back the data from Notepad++. It helped me.

Some end tag character like '>' should be there in your xml. Remove this and error will be gone.

You Might Also Like