user590849
user590849

Reputation: 11765

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.

Upvotes: 13

Views: 5620

Answers (4)

Will Tate
Will Tate

Reputation: 33509

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

Upvotes: 5

sparksalot
sparksalot

Reputation: 528

While other answers about the ampersand may be correct, I don't think its just that.

This should be of some use.

Where an attribute value is a string, double backslashes ('\') must be used to escape characters — for example, '\n' for a newline or '\uxxxx' for a Unicode character.

You have \n, which may need to be \\n in addition to the change to the &

Upvotes: 3

Varun
Varun

Reputation: 33983

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

copy paste the code i have pasted. use this string use &amp; instead of &

Upvotes: 3

Haphazard
Haphazard

Reputation: 10948

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

Upvotes: 45

Related Questions