Built-in entity references

The first and most widespread use of entity references is to avoid the problem of confusing markup delimiters with data characters. Depending on the context of its usage, document authors may need to use the references listed below instead of the actual characters they represent:

  • &lt; for '<'

  • &gt; for '>'

  • &amp; for '& '

  • &apos; for ' ' ' (in attribute values)

  • &quot; for ' " ' (in attribute values).

The true nature of the 'escape-codes' introduced earlier is now evident. Although entities are far more flexible than escape-codes, they do serve this simple purpose very well.

As previously indicated, the angle bracket entity reference must be used in place of the actual character within text, so that the XML processor can safely ...

Get XML Companion, The, Third Edition 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.