O'Reilly logo

Inside XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. This means that those names must be declared, with their prefixes, in the DTD.

Here's an example; I'll start with the easy case where I'm using a default namespace like this:

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required