are characters # or & allowed in xml?

yital9 picture yital9 · Aug 7, 2012 · Viewed 37.6k times · Source

i have values with special chars that encoded to ascii in my xml. for example :

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <name>&#381;irm&#363;n&#371;</name>
</response>

but when i parse value name i get only & as value. Is it allowed to use # or & in xml? or i have to use cdata necessarily?

Answer

Ivan picture Ivan · Aug 7, 2012

The & character appears to be illegal, use (below) instead.

&amp;

Invalid Characters in XML

The # character should be OK.

Also this may be useful: http://xml.silmaril.ie/specials.html.