The XHTML WYSIWYG Editor For Desktop & Web Applications

Namespaces

Namespaces are a way to distinguish tag names for different XML vocabularies. For example, if bookstore A and bookstore B use the tag name <book> to identify a book, there can be a conflict when data from both bookstores is used in the same document.

To avoid the conflict, each bookstore's tags can be grouped into a namespace. Namespaces are unique names, usually written in the form of a URL, that identify a set of tags. Thus, bookstore A can define a namespace such as http://apple-books and bookstore B can define a namespace such as http://big-books.

Since namespaces are quite long, repeating the entire namespace for each tag can be quite bulky. Therefore, a short name called a prefix is associated with each namespace, and the association made in the markup like this:

  1. <p xmlns:a="http://apple-books" xmlns:b="http://big-books"> ... </p>

Alternatively, the association can be specified in the Namespaces <param> tag. For example:

  1. <param name="Namespaces" value="xmlns:a='http://apple-books' xmlns:b='http://big-books'" />

Once namespaces are declared and the association established between a prefix and a namespace, the prefix can be used to make each <book> tag unique. For example:

  1. <p>
  2. Buy <a:book>Easy XHTML</a:book> from Apple Books<br />
  3. Buy <b:book>Easy XHTML</b:book> from Big Books
  4. </p>