External entity declarations

A base definition has no effect on external entity references that use a relative reference. This is due to the fact that these declarations occur outside of the root element, so are not in the scope of that element (or of any other element).

In the following example, the DTD file 'coll.dtd' will not be sought in the 'Orwell' directory, and neither will the document '1984.xml':

                      <!-- NOT AFFECTED -->
<!DOCTYPE collection SYSTEM "coll.dtd"
[ ...
  ...                <!-- NOT AFFECTED -->
  <!ENTITY book1984 SYSTEM "1984.xml">
  ...
]>
<collection xml:base="file:///d:/colls/Orwell/">
  ...
  &book1984;
  ...
</collection>

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.