Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

android

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?

like image 632
gsfd Avatar asked Sep 21 '11 20:09

gsfd


People also ask

How do I get special symbols on my keyboard?

Inserting ASCII characters To insert an ASCII character, press and hold down ALT while typing the character code. For example, to insert the degree (º) symbol, press and hold down ALT while typing 0176 on the numeric keypad. You must use the numeric keypad to type the numbers, and not the keyboard.

How do I type a symbol in Word?

Go to Insert > Symbol > More Symbols. Go to Special Characters. Double-click the character that you want to insert. Select Close.

How do I enter Unicode characters?

Unicode characters can then be entered by holding down Alt , and typing + on the numeric keypad, followed by the hexadecimal code – using the numeric keypad for digits from 0 to 9 and letter keys for A to F – and then releasing Alt .


2 Answers

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

like image 97
Matt Ball Avatar answered Sep 22 '22 14:09

Matt Ball


& would be &.

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

like image 43
David Avatar answered Sep 22 '22 14:09

David