Previous Table of Contents Next


General entities deal with string and character substitutions of one kind or another for document content. Parameter entities contain system processing information.

Internal and External General Entities. Think of internal general entities in terms of character references and string references. These characters or strings could be like small sections of contract boilerplate or special foreign characters for which you need a convenient way of referring to in text. Or, suppose you want to tell the SGML system that CALS always means Continuous Acquisition and Lifecycle Support rather than the now-obsolete Computer-Aided Logistics Support. You could use an internal general entity, &CALS, for example. You could also use these characters or strings with equations or special features of text, such as superscripts and subscripts. See the following example of the De Broglie relation, which is an important physics equation, developed in 1927, that expresses the wave-like properties of the electron.

Here’s what it would look like before it became tagged with SGML:

   Now we turn our attention to the De Broglie relation: Λ=h/p

Here’s what it might look like in an SGML document instance:

  <para>Now we turn our attention to the De Broglie relation:
  <equation id=broglie>&wavelen;=&hvalue;<over>&momentum;</equation><para>

Somewhere, the symbols for Λ and h and p would have to be defined; in this case as &wavelen;, &hval;, and &momentum; respectively. And the division symbol would have to be defined as <over> in this case.

External references are references to bigger objects, like a chapter or block of text. These could be whole modules of your document content, or even documents within documents. The external general entity could be a file that gets loaded into your document from some external resource. If you were processing an entire book at one time, you could make each chapter an external general entity—&chp1;, &chp2;, and so on—so your processing system wouldn’t have to load the entire book at one time. It could process your book dynamically as necessary.


NOTE:  
During processing, the SGML system must be able to locate all external and internal entities and resolve their values. If they are not available locally, they must be made available or you will get a parsing error.

A parsing error is an SGML system error during document processing. It means the SGML processing system, like a conveyor belt in an assembly line, is experiencing a technical difficulty and might even have to stop. At the very least, you will have to address the technical difficulty.



• See “Evaluating Parser Output Messages,” p. 244

Internal and External Parameter Entities. Parameter entities deal with document substitutions or references that are usually outside the scope of the document itself. On the document level, you would normally see parameter entities in the SGML declaration, particularly if you’re calling on external character sets for special symbols, or on PUBLIC information like that mentioned in the discussion on declarations earlier in this chapter.

Parameter entities always start with the opening delimiter, which is a % sign, followed by the name of the entity and the closing delimiter, which is a semicolon (;).

You’ll run into parameter entities in documents when there’s some section of text that must be treated specially. For example, sometimes you want to tell the SGML system to ignore a section of text, but because IGNORE is a reserved word that can only be used under special circumstances in SGML markup, you would probably want to use a parameter entity for it. Suppose you tell the SGML system in your DTD for a document that the entity %ign means “IGNORE” in your markup and elicits the proper behavior from the SGML system without alarming it with a reserved word. Your document instance might have markup like this:

   There are two sentences of text that might apply here.
   This phrase does apply, it so happens.
   <![ %ign; [But this text does not apply, so we must ignore it now.]]>
   Here’s where the normal text continues after the ignored text.
   Just like nothing happened. And all we’d have to do is change the value
   of %ign to "INCLUDE" in the DTD and the section would not be ignored in
   any of the instances for that DTD.

This example is for an internal parameter entity because the entity applies just to this document. The processing system is not going beyond the local scope of this system to resolve the value of this entity.

External parameter entities become important when you refer to public DTDs or fragments of data that you need to borrow for the processing of your document. Public DTD fragments frequently are referenced by using external parameter entities. Basically, if there’s some DTD in the public domain to which you want to refer or if there’s some document type that you want to use as a model, you can do so using a parameter entity in your DTD. The machine that processes your DTD has to be able to find it on your system or network, however.

Document Content

The most important part of your SGML document is the content itself. Content isn’t just the alpha and numeric characters strung together to form words and sentences, it’s also the meaning you want to convey with them. The characters all strung together are just the medium through which that meaning gets conveyed. So content can loosely refer to both the vast character string, as well as the meaning you want them to convey when they’re assembled properly.


Previous Table of Contents Next