Predefined General Entity References

As we already know, there are five predefined entity references in XML, and they stand for characters that can be interpreted as markup or other control characters. Here they are:

  • & becomes the & character.

  • ' becomes the ' character.

  • > becomes the > character.

  • &lt; becomes the < character.

  • &quot; becomes the " character.

It turns out that you can create entity references for individual characters yourself in XML. All you have to do is specify the correct character code in the encoding you're using. For example, in the UTF-8 encoding, the character code for @ is #64 (where the # indicates that this value is in hexadecimal), so you can define an entity named, say, at_new so that references to at_new ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.