Making work in XML, RSS, and Atom
If you came to XML, RSS, or Atom from an HTML background then you have probably already found that many of the entities you used in HTML don't work.
Although XML, by default, defines the following 5 entities:
| XML Entity | Description | Symbol |
|---|---|---|
& |
Ampersand | & |
< |
Less Than Sign | < |
> |
Greater Than Sign | > |
" |
Double Quote | " |
' |
Apostrophe | ' |
Many of the entities you are probably familiar with do not by default exist in XML. Entities like ©, ·, and many others; including .
Probably the most frustrating to me at times is the lack of support for . Especially when embedding XHTML into an Atom <atom:content type="xhtml"> element.
Here's how to make work in XML, RSS, and Atom.
What is a
The entity is the HTML entity for a non-breaking space. A non-breaking space is a special space character that prevents a line break when a line wrapping algorithm is applied to render the text.
In HTML one of the common uses for the is to get multiple consecutive spaces in a row.
XML Entities and Unicode Code Points
In Unicode, each and every character has a numerical value. Here's some examples:
| Character | Description | Decimal Value | Hexadecimal Value |
|---|---|---|---|
| E | Capital "E" | 69 | 45 |
| x | Lowercase "x" | 120 | 78 |
| Non-Breaking Space | 160 | A0 | |
| ‽ | Interrobang | 8253 | 203D |
| ♥ | Heart | 9829 | 2665 |
In XML, you can use any Unicode characters with a special type of entity. (Although your browser may or may not have a font glyph to render the character on screen.)
You can either use the Unicode numerical decimal value of a character. As in ‽ for Interrobang.
Or you can use the Unicode numerical hexadecimal value of a character. As in ‽ for Interrobang.
Although the decimal form of these types of entities is better supported in the common web browsers. (So, for the Interrobang, it would be better to use ‽ rather than ‽.)
The Other Non-Breaking Space Entity
So to use in XML, RSS, and Atom, it's simple. Use the following entity:
 
It's that simple.
-- Charles Iliya Krempeaux, B.Sc.