XML Tutorial/Introduction/Entity
Illegal PCDATA Characters and Escaping Characters
<!--This is not well-formed XML!-->
<comparison>6 is < 7 & 7 > 6</comparison>
You can"t put < or & characters into PCDATA.
There are two ways you can get around this: escaping characters, or enclosing text in a CDATA section.
To escape the < or &, you replace any < with < and any & with &.
The previous XML example could be made well formed:
<comparison>6 is < 7 & 7 > 6 </comparison>
< and & are known as entity references.
The following entities are defined in XML:
& - the & character
< - the < character
> - the > character
' - the ` character
" - the " character
Other characters can also be escaped by using character references.
These are strings such as &#nnn;, where nnn would be replaced by the Unicode number of the character.
Or &#xnnn; with an x preceding the number, where nnn is a hexadecimal representation of the Unicode character.
To include the copyright symbol ((c)), inserting © or ©.
Entity references must be declared
SELECTED CHARACTER CODES
Name Entity Reference
Trademark ™:
Copyright ©
Register ®
Plus or minus ±
One-quarter ¼
One-half ½
Three-quarters ¾