Namespaces and DTDs

There's one more topic that I want to cover now that we're discussing the basics of creating DTDs: how to use namespaces when you're using DTDs. In fact, this will give us an introduction to the next chapter, where we'll work with declaring attributes as well as elements.

The important thing to recall is that, as far as standard XML processors are concerned, namespace prefixes are just text prepended to tag and attribute names with a colon, so they change those tag and attribute names. That means those names have to be declared, with their prefixes, in the DTD.

Here's an example. I'll start with the easy case in which I'm using a default namespace, like this:

 <?xml version = "1.0" standalone="yes"?> <!DOCTYPE DOCUMENT [ <!ELEMENT ...

Get Real World XML 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.