Home » Android » android found tag … where item is expected

android found tag … where item is expected

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m working on a project that has a custom XML file in the res/values map.

It’s not a deep XML:

<resources>
    <accesspoint
    ...

Eclipse is generating an error: found tag accesspoint where item is expected

Now, I’ve googled this a bit and there are similar problems everywhere. But no solution.
When I change them all to item and give them a name and a type, I still get an error on the closing tags that simply says “Orginally defind here”.

I’m out of ideas here, does anyone know what this means? And how I fix it?

How to&Answers:

Something is a bit screwy in Eclipse. I had the same problem as you no matter what I renamed the tag.

Solution: delete the tag, and re-write it by hand (DON’T COPY/PASTE).

There must be some kind of strange hidden character that gets in there somehow, because just re-writing the EXACT same thing, and I now have no errors.

Answer:

Right click on the xml file in the package explorer, then Source -> Format.

Answer:

Tried all of the above solutions. None of them worked. Found the problem in Eclipse:

Copy the xml file from res/values folder to res/xml folder.

Answer:

Running the xml source file through xmllint is a good way to pick up otherwise non-visible special characters. In particular keep an eye out non-breakable space (&nbsp;/ / ) which can cause cryptic errors if they occur where the ADK tools are expecting whitespace.

Answer:

open the xml file with MadEdit or any other Hex File editors, look for “C2 A0” and replace all with normal space.

Or simply in the command line

$sed -i ‘s/\xc2\xa0/ /g’ /the/path/to/the/xml/file

Answer:

There can be many reasons for this error. Probably these issues are arising due to simple mistakes.

Those can be

  1. Invalid characters in the string value . Remove unsupported characters and check .
  2. When we are cop/paste from some other places , there can be possible of having hidden/unnoticed invalid characters , so check for that and remove those.

Advice :
Instead of copy/paste , type by yourself.

Answer:

Sometimes Eclipse goes crazy.

Paste your code in Notepad and then copy it from Notepad and paste it to Eclipse.