Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - string.xml parsing error

i have made a string named info_data as follows

<string name="info_address">SVG Service Verlags GmbH & Co. KG\n
    Schwertfegerstra?e 1-3\n
    D-23556 L?beck\n
</string>

i am getting an xml error saying that

Multiple annotations found at this line: - The entity name must immediately follow the '&' in the entity reference. - error: Error parsing XML: not well-formed (invalid token)

this error comes on the first line containing the &.

what is going wrong and how do i fix it.

thank you in advance.

like image 782
user590849 Avatar asked Apr 26 '11 12:04

user590849


People also ask

What is Strings XML in Android?

Note: A string is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). So, you can combine string resources with other simple resources in the one XML file, under one <resources> element. file location: res/values/filename.xml. The filename is arbitrary.

What is XML parsing in Android?

Android DOM(Document Object Model) parser is a program that parses an XML document and extracts the required information from it. This parser uses an object-based approach for creating and parsing the XML files. In General, a DOM parser loads the XML file into the Android memory to parse the XML document.

What causes XML parsing error?

The most common cause is encoding errors. There are several basic approaches to solving this: escaping problematic characters ( < becomes &lt; , & becomes &amp; , etc.), escaping entire blocks of text with CDATA sections, or putting an encoding declaration at the start of the feed.


2 Answers

You can't use the & sign. Try &amp; (I haven't tested it but it may work).

like image 102
Haphazard Avatar answered Oct 11 '22 10:10

Haphazard


I believe you will need to change the & to &amp;.

like image 41
Will Tate Avatar answered Oct 11 '22 10:10

Will Tate