DTD declarations
When a DTD is in use, the xml:base attribute needs to be defined explicitly for each element it may be allowed to appear in:
<!ELEMENT collection xml:base CDATA #IMPLIED>
When the element name is significant enough to imply a specific base location, this location can be inserted into the DTD as a default value:
<!ELEMENT image xml:base CDATA "file:///d:/images/">
It is even possible that the value should never be changed, in which case it could be made into a fixed attribute value:
<!ELEMENT image xml:base CDATA
#FIXED "file:///d:/images/">
Warning
These techniques should not be used if there is any possibility that the XML documents will be processed using parsers that do not validate them against a DTD or schema, or when ...
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.