Namespaces have been a W3C standard since January 1999. The idea behind namespaces is simple: We need a way to fully qualify XML element and attribute names to prevent from confusing two elements that have the same name but mean different things.
For example, you might have an accounting application that uses an
element called <schedule>
to mean an accounting schedule. A time management application
might use the same element <schedule>
to mean a time schedule. You might
need to put accounting and time management data in one XML document. For example,
you might be keeping track of all project information including accounting and
project timeline in the same document. Now each application would not be able
to tell which <schedule>
element belongs to it. To solve this problem,
you could prefix each <schedule>
element with a unique prefix that indicates
to which application it belongs. For example <accounting:schedule>
and <time:schedule>
would
make things much clearer. In this example accounting and time are namespaces.
Namespaces are simply a way to uniquely identify elements and attributes within a document.
Comments