Home » Android » java – How to put the character & into an xml in android correctly

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

Posted by: admin June 15, 2020 Leave a comment

Questions:

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?

How to&Answers:

If \& doesn’t work, try the XML entity &.

Answer:

& would be &.

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

Answer:

in the context of an XML

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

Answer:

It’s very simple. Use &amp;