Attributes Entitites   «Prev 

Defining multiple characters

Imagine that you are working on a new software product code-named "Maui." You may need to create a host of marketing information for your Web site, and you would not want to manually search and replace the word "Maui" on each of 50 pages with the eventual product name.
So you could create an entity named &NewProduct; such that the entity could contain "Maui" until the name of the product is decided. You would then simply replace the string "Maui" in the entity declaration with the new product name. Once you do this, everywhere that &NewProduct; has been specified, the new product name will appear.


Single XML document

A single XML document can draw both data and declarations from many different sources in many different files. In fact, some of the data may draw directly from databases, CGI scripts, or other nonfile sources. The items where the pieces of an XML document are stored, in whatever form they take, are called entities. Entity references load these entities into the main XML document. General entity references load data into the root element of an XML document. <, >, ', " and & are predefined general entity references that refer to the text entities <, >, ', ", and &, respectively. Parameter entity references load data into the document's document type definition (DTD). They begin with a % instead of an &. Unparsed entities point to non-XML, binary data whose type is identified with a notation and are referenced by an ENTITY type attribute. All three kinds of entities are declared in the DTD.