Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape the < and ≤ symbols in xml?

I want to create a string <res> in android as below:

<string name="bmi0">0: BMI≤18.5</string>
<string name="bmi1">1: 18.5<BMI≤24</string>
<string name="bmi2">2: 24<BMI≤27</string>

But i shown the error of "Tag start is not closed".

I tried to put a \ symbol in front, but it doesn't work, it has shown the same error.

<string name="bmi0">0: BMI\≤18.5</string>
<string name="bmi1">1: 18.5<BMI\≤24</string>
<string name="bmi2">2: 24<BMI\≤27</string>

How to escape the special XML symbols ?

like image 284
user2301281 Avatar asked Dec 13 '13 12:12

user2301281


1 Answers

You will have to escape those symbols as following:

  • < will be &lt;
  • > will be &gt;

The sign doesn't need escaping.

like image 147
Konstantin Yovkov Avatar answered Oct 15 '22 13:10

Konstantin Yovkov