Entity references

Usually, an entity reference is a simple markup construct that begins with an ampersand character, '&', and ends with a semicolon, ';'. The body of the construct is a reference to the name of the entity. The following example is a reference to an entity called 'XML' (which might have a replacement value of 'eXtensible Markup Language'):

The &XML; format is useful.

SGML Note

The semicolon is always required, even when followed by a space.


The entity reference is detected by an XML parser as it reads the data, and is removed. Its place is taken by the replacement value, which is then also parsed as if it had always been an integral part of the document:



Entities can also be referenced from attributes (with some limitations):

<dataFormat name="XML (&XML;)">...</dataFormat>

When DTDs are in use, the value of an attribute in an empty element can also be identified as an entity reference. In the following example, the Pic element refers to the entity called 'JSphoto' (Chapter 5 explains how to specify such attributes):

Here is a photograph <pic name="JSphoto" /> of J. Smith.

In DTDs, the format is slightly different.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.54.6