|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
The following list describes the different places in which an entity reference can occur and how it is treated there.
An entitys replacement text may contain character entity, parameter entity, and general entity references. Character references and parameter entity references in the value of an entity are resolved when the entity is resolved. General entity references are ignored. When an entity reference is replaced, the entitys replacement text is retrieved and processed in place of the reference itself, as though it were part of the document at the location the reference was recognized. The replacement text may contain both character data and (except for parameter entities) markup, which is recognized in the usual way, except that the replacement text of the entities amp, lt, gt, apos, and quot is always treated as data. To validate a document, the replacement text for parsed entities also has to be parsed. If the entity is external and the document is not being validated, the replacement text doesnt have to be parsed. If the replacement text isnt parsed, the application is told of this, and it is up to the application to handle it. When the name of an unparsed entity appears, as in the value of an attribute whose declared type is ENTITY or ENTITIES, the system and public (if any) identifiers for both the entity and its associated notation are simply passed to the application. The application is then responsible for any further processing (such as displaying the graphic file in a window). Getting the Most Out of EntitiesAs you may remember, a fixed order exists in which the external and internal DTD subsets are read and interpreted. First the internal DTD subset is read and then the external DTD subset. If something is declared in the internal DTD subset, its declaration cannot be changed in the external DTD subset, although some things (such as additional attributes) can be added to declarations. Used with a little careful planning, this hierarchical arrangement can enable you to construct your information collection (such as a Web site) to make the maximum use of shared data (see Figure 15.2):
Breaking the documents into modules and exploiting the order in which the internal and external DTD subsets occur allow you to modularize a lot of documents, but you can go even further than this when you need to. You can even modularize the DTD itself and collect the parts you need for a particular document type (although in this context you could almost call it a subtype). Many (large) industrial implementations of SGML use this scheme. Some people call this a pizza model because you build your DTD out of a base (core) of essential elements and then add the toppings that you need for the particular document. Examples of major DTDs that use this are the Text Encoding Initiative DTD and the American Department of Defense DTDs used for Interactive Electronic Technical Manuals (IETM). This same approach could just as easily be used in XML. In fact, it could probably be used more easily because XMLs capability to include Internet URLs as the locators for fragments makes it far easier to physically distribute data while still being able to bring it all together as a coherent set of information. Although you have to use external entities to include binaries, such as graphics files, in your formatted XML output, entities can be a wonderful tool for breaking up the task of managing a complex collection of many documents into manageable chunks. By the considered use of internal and external text entities combined with the hierarchical ordering applied to interpreting the two DTD subsets, you can implement a staged hierarchy of template content. At the global level, you can safely set up default settings and then let individual XML documents implement local overriding changes as you need them.
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |