Namespaces |
|
DTD and XML |
|
  |
You can use namespaces in your XML document.
In writing an XML document you can use the namespace setup by the writer of the DTD
you are using. In theory, there is a way to fake a limited way to use local names with a DTD. It is dificult to set up, and could sometimes be impossible to use. We will ignore that approach. |
Selecting a name |
|
If you were to set up a namespace,
the first thing you need to do is select a name for your namespace.
It might be good to select a long name, so it will not be the
same as the name someone else is using. You might select:
I know a better way to select a name, so it will be unique.
I will select the name: A real address is called a Uniform Resource Locator(URL). A name that looks like a URL is called a Uniform Resource Identifier(URI). A URI might be a real URL address, or it might not be. I do not have a directory mary, so the name I selected is just a URI.
If you look at the source for this document, you can see a namespace
specified in the |
|
Default namespace |
|
The simplest use of a namespace is to specify a default namespace
for everything in the document.
To do this, put an
The root element for an XHTML 1.0 page is always the |
|
Changing the namespace |
|
You may wish to provide a default namespace for the whole document in the root element,
but change to a different namespace for one of the elements within the document. |
|