[Previous] [Contents] [Next]

External Parameter Entities

External parameter entities are just like internal parameter entities except that they retrieve the replacement text from external files.

Declaring an external parameter entity

The syntax for declaring an external parameter entity is similar to the declarations for internal parameter entities, except that the SYSTEM keyword or the PUBLIC keyword is used. The syntax for the declaration is shown here:


<!ENTITY % name SYSTEM  "string_of_characters">

To use the external parameter entity, you could place all of the parameter entities that were defined in the example DTD in a file named Parameter.dtd. To do so, you would add the following code to the XML document:


  <!ENTITY % parameterentities SYSTEM "Parameter.dtd">
  %parameterentities;
  <!--================ Document Structure=========================-->
  <!ELEMENT html  (head , body)>
  <!ATTLIST html  %i18n;
                  xmlns CDATA #FIXED 'http://www.w3.org/1999/xhtml'>

  <!--Rest of DTD here-->

First we declare the parameterentities entity, which links to the external Parameter.dtd, and then we use parameterentities to insert this document into the XML document. This external parameter entity could be used to create several DTDs. External parameter entities are useful when parts of your DTD will be used by several other DTDs.


[Previous] [Contents] [Next]