Entities |
|
Built-in entities |
|
We have already seen the five built-in character entities. They are:
|
|
Character entities |
|
We have also seen character entities. Character entities are characters specified by their decimal or hexadecimal numeric value. Most UTF-8 characters work. Examples:
Most western european letters, and many other UTF-8 symbols work in XML 1.0. Others do not. The UTF-8 Cherokee characters are not in the XML 1.0 standard, and are not in the character set in my computer, so they do not show up. |
|
General entities |
|
single character
You can build your own entity, which you can then use like a built-in entity
or a character entity. You can build your own entity, containing any character you wish.
In the source of the example to the left, you can see: |
|
multiple charactersYou can build your own entity, containing a string of multiple characters.
In the source of the example to the left, you can see: |
|
single element
You can build your own entity, containing an element.
In the source of the example to the left, you can see: |
|
multiple elements
You can build your own entity containing more than one element.
In the source of the example to the left, you can see: |
|
|
externalIf you have a very large amount of text, or a large complex set of element, you may wish to put it in an external file. On the other hand, having the data spread over multiple files slows down the whole process of interpretation, and makes the interpretation more complex.
In the source of the example to the left, you can see: I had some difficulty getting this example to work on my machine. My security settings would not allow it in Firefox. I was able to bypass some of the security, by responding to the message in the information bar in Internet Explorer. |
where you can use entities |
|
text
A built-in entity provides one character of text.
These entities can be used anywhere in the XML document, where text is allowed
within an element or attribute value. |
|
elements
Some general entities provide XML elements.
The entities containing elements can be used anywhere in the XML document,
where the elements are allowed. |
|
entities within entitiesYou can use entities within the text in an entity, because this is text that will be put into the XML document. This can easily become complex. |
|
parameter entities
In the next section, we will look at parameter entities.
Unlike the other kinds of entities, parameter entities
must be used only within the DTD. |
|
parameter |
|
parameterparameter entities are different than other entities.
The link to the left provides a discussion and examples. |
|