xmlspecial-charactersreserved

What are the official XML reserved characters?


In this page, Microsoft says that XML reserved characters (and their entity) are the following ones:

>    >
<    &lt;
&    &amp;
%    &#37;

But in this other page, I found that also ' is a reserved character (and its entity is &apos;).

Can someone indicate me some official reference in which are listed all and only the XML reserved characters?


Solution

  • According to the XML spec, the only characters that must be escaped when used as character content rather than markup are:

    You don't have to escape double quotes in single quoted attributes or vice versa, but it won't do any harm if you do so.

    Of course, you may escape every >, " and ' (and any other character) within character content if you want to, without changing the meaning.