Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

are characters # or & allowed in xml?

Tags:

xml

ampersand

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?

like image 820
yital9 Avatar asked Aug 07 '12 07:08

yital9


People also ask

What are characters example?

Examples of characters include letters, numerical digits, common punctuation marks (such as "." or "-"), and whitespace. The concept also includes control characters, which do not correspond to visible symbols but rather to instructions to format or process the text.

What are the 3 types of character?

Protagonists = change with the plot (focal point of the story) Main Characters = drive the plot and makes the change happen. Heroes = Who we want to win/succeed.


2 Answers

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.

like image 113
Ivan Avatar answered Oct 22 '22 02:10

Ivan


& needs to be escaped as it is used for esaping itself. All escapes start with & (&quot;, &lt;, &gt;).

&amp; is the escape for &

like image 6
victorsavu3 Avatar answered Oct 22 '22 03:10

victorsavu3