Clearly, as DTDs and their elements are being created all over the world, all the time, name collisions are bound to occur. Our document might call in two different DTD protocols, perhaps from two different vendors . For example, we might want to handle two different formats for news sources, the RSS/RDF format from Netscape and the CDF from Microsoft.

Both define, for example, an element called <title> and another called <item> , but these elements have different meanings and very different structures. If our XML is to use both of them, it must be able to easily distinguish between them. It does so by putting a prefix in front of each one, separated from the original name by a colon . Thus we might have <microsoft:title> and <netscape:title> . Or <cdf:title> and <rdf:title> .

It remains to link the initials cdf and rdf to globally unique names, not casual acronyms. The mechanism for selecting globally unique names is the URI (e.g., URL) system of domain ownership. The line


appears to reference a document on the web. However, it is merely using this unique location to create a unique namespace. It links the abbreviation rdf to this unique identifier during the processing of this DTD. It is considered good form (though not a requirement) to have documentation of some sort at the named URI.

With this definition and a similar one for CDF, we can easily refer to each sort of item element as




In fact, we can even define the namespace of the null prefix. With the line


we assign to the null prefix the namespace that used to be assigned to rdf . The result is that unprefixed elements like <item> or <title> will have the meaning previously held by <rdf:item> and <rdf:tile> .

Flash and XML[c] A Developer[ap]s Guide
Flash and XML[c] A Developer[ap]s Guide
ISBN: 201729202
Year: 2005
Pages: 160 © 2008-2017.
If you may any questions please contact us: