gsfd
gsfd

Reputation: 1070

How to put the character & into an xml in android correctly

I have a string that says "the following characters are invalid: "! @ # $ % ^ \& * ( ) / \ or space" and i don't know how to put the & symbol into an xml file without causing an error? I know you are suppose to do something along the lines of \& but I'm not sure exactly what it is?

Upvotes: 8

Views: 8486

Answers (4)

AMAN SINGH
AMAN SINGH

Reputation: 3561

It's very simple. Use &

Upvotes: 0

David
David

Reputation: 1143

& would be &.

Wikipedia has a list of XML and HTML character entity references.

Upvotes: 8

Ilya Saunkin
Ilya Saunkin

Reputation: 19790

in the context of an XML

& is &
< is &lt;
> is &gt;

Upvotes: 6

Matt Ball
Matt Ball

Reputation: 359776

If \& doesn't work, try the XML entity &amp;.

Upvotes: 23

Related Questions