Defining General Entities and Parameter Entities in DTDs

In DTDs, an entity allows you to define a symbol for a value. In the Tree view, you can define general entities and parameter entities. The value of a general entity can be just about anything. It can be

  • A short string that represents a longer string
  • A way to include another marked-up file
  • A reference to a graphical image
  • A placeholder for some non-XML data or an expression that needs special formatting

General entities are useful for things that change often, such as the name of a product in development. An entity allows you to change the value in one place and have the corrected value appear everywhere it is needed.

See also Description of Entity and Parameter Entity Properties in DTDs.

When you define a general entity, you specify a symbol that you can use in instance documents. When the XML parser finds a reference to a general entity, it replaces the symbol with the value you specified when you defined the general entity.

When you define a parameter entity, you specify a symbol that you can use elsewhere in the DTD. Again, when the XML parser finds a reference to a parameter entity, it replaces the reference with the value you specified when you defined the parameter entity.

In a DTD, the definition of an entity must appear before a reference to that entity. Therefore, it is good practice to put all entity declarations at the beginning of a DTD.

This section discusses the following topics:

XQuery Talk Blog

Get the latest XQuery news and information at XQuery-Talk - an online community for discussing XQuery technologies, examples, implementations and more. Bookmark this RSS or ATOM feed now!

Microsoft .NET XML Tools for System.XML 1.0 and System.XML 2.0

Stylus Studio features integrated XML validation, XSLT transformation and XSLT debugging using the official Microsoft .NET XML processing components: System.XML 1.0 and System.XML 2.0.

XML to PDF

Convert XML to PDF using Stylus Studio's XML publishing tools - the easiest way to design beautiful document layouts for use in XSL:FO based multi-channel publishing and single source publishing applications.

Technology Companies That Use Stylus Studio

Technology companies can't always handle every technology that they come across. That's why when it comes to XML, they look to Stylus Studio to guide them. Check out which top technology companies are looking to the future with Stylus Studio.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member