Entity declarations without DTDs: yet another approach?

With a Future of XML workshop in the offing, maybe it’s time to revisit one of the oldest XML feature requests: binding general entities without using the internal/external subset.

There have been numerous more-or-less serious proposals to address this requirement over the years—here’s a new (?) one.

Suppose we introduce a new official PI, named xml-entity:

<?xml-entity copyright "©"?>

with the obvious consequence that any use thereafter of &copyright; would produce a ©. That would allow a few entity declarations to be added to an XML document.

To enable large numbers of entity ‘declarations’ to be managed effectively, the next step would be to introduce xml-entities as well:

<?xml-entities PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"?>


<?xml-entities SYSTEM "myentities.ent"?>

where the referenced files could use either the old <! ENTITY syntax or the new PIs.

Simple, low-impact, and it’s backwards compatible. It won’t work with SOAP, which forbids PIs altogether (why?).

5 thoughts on “Entity declarations without DTDs: yet another approach?

  1. I’d prefer them hardcoded. I don’t want to add yet another hideous magic string to my documents.

  2. kl:Seems to me there are too many communities with different needs wrt entity usage to make hardcoding a viable option.

    David Lee: Over the years as XML has come to stand more on its own, a generation or two of users has arisen who don’t or can’t use DTDs. In the early days of W3C XML Schema one of the very common FAQs was “why doesn’t Schema provide for entity declarations?” But w/o DTDs, there is no way to give short names to non-easily-typeable characters, which many people would like. The above proposal attempts to give them what they want, w/o requiring support for DTDs.

    Tim BL: Indeed PIs are imperfect, but they sort of fit with entities for these purposes, in that their effect, like that of entities, is prior to all the interesting Infoset-level stuff. And yes, they aren’t scoped, and their syntax is . . . underconstrained, but entity decls don’t need to be scoped (they aren’t now, after all), and they are part of well-formed XML, so are at least parsed everywhere (that’s what I meant by backwards-compatible above). . .

  3. How are they backwards-compatible? Older UA’s will reject any file that uses entities defined in PI.

Comments are closed.