
In "real life", the document type declaration (the very first lines of your DocBook file) is slightly more complicated than the single line presented in the document skeleton in the previous section.
We'll examine in the following sections why it makes sense to add declarations here.
Example 4-1. Entities used to share text
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" [ <!ENTITY cereals "<productname>Frobozz Cerals</productname>"> <!ENTITY orange-juice "<productname>Hourmade Orange Juice</productname>"> ]> <book id="marketing-study" lang="en"> <bookinfo> <title>Marketing study about &cereals;</title> </bookinfo> <chapter id="introduction"> <title>Introduction</title> <para> This study describes the expected impact of the new &cereals; product, and examines the opportunity of an advertising campain combined with the &orange-juice;. </para> </chapter> </book>
You find there "entity definitions" that makes &cereals; a synonymous for the "Frobozz Cereals" product name, marked up as <productname>Frobozz Cereals</productname>.
The example will look something like this when converted:
This study describes the expected impact of the new Frobozz Cerals product, and examines the opportunity of an advertising campain combined with the Hourmade Orange Juice.
Proceeding like this has a number of advantages:
It spares the hassle of typing several times the very same thing
It allows to centralized the changes to commonly used sentences into one single place
If the entity name is chosen with caution, it makes the source text more legible