Versioning DTDs?

Liam R. E. Quin liamquin at
Mon Oct 25 04:15:07 BST 1999

> Ken Gentle wrote:
> > In developing an e-commerce dialog (using XML, of course), we've determined
> > that the messages need to be versioned.  Specifically, we'll need to have
> > some way of versioning a DTD such that the XML parser can "figure out"
> > which version of the DTD to use.

Yes, this is a common need, both for XML and for SGML.

> > As the XCatalog stuff (for PUBLIC entities) is not widely supported yet
> > (based on my rather naive perspective), simply mapping the PUBLIC ids to
> > different DTDs won't work.

Furthermore, XML requires a working SYSTEM ID, so if you use PUBLIC, it's
essentially a comment.  I don't want to start flame wars about whether
PUBLIC is useful or not (***please!!!!****),but yuo are correct in
thinking it is not handled the same way everywhere.

If you used a catalog file, yuo would want to map SYSTEM IDs and not
PUBLIC ones in XML.

> > Additionally, there is the "change-over
> > period":  what if I have messages/documents to process in my "queue" when
> > the publicly available DTD changes?  If the structure of the two versions
> > of the DTD are incompatible, I've introduced a problem...

In SGML (not XML), a PUBLIC identifier always returns the same set of
declarations -- it can't change just because yuo changed your DTD.  This
means that many people put the version number.

On Mon, 25 Oct 1999, Marcus Carr wrote:
> I have used OmniMark to manage the dependancies for an SGML dataset by
> putting APPINFO in the declaration, fixed attributes in the DTD and
> attributes representing the current DTD in the document.

Another(similar) aproach involves using CVS or RCS, if you are in the
open source world :-)

Put the major revision number in a #FIXED attribute in the DTD; for example
<!ATTLIST document
    DTDversion CDATA #FIXED "$Revision$"

and every time you check the DTD into the main DTD repository, the attribute
will be updated automatically.  Same with the System identifier of the
DTD, although you may need to put the right thing there with perl or
omnimark or Python (hi Paul!) or whatever.

You can then write a servlet or CGI script or mod_perl thing or whatever
to retrieve the right DTD automatically, using "rcs -p" for example, perhaps
with a cache of recently used files.  For a non-web appilication, it depends
on the software, though , so including the major version number of the DTD
in the filename is a good bet for both cases.


Liam Quin, Barefoot Computing, Toronto;  The barefoot programmer
l i a m q u i n     at    i n t e r l o g    dot   c o m,
co-author, The XML Specification Guide, Wiley, 1999

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list