|
Here, "student" is from the http://www.develop.com/student namespace while
"name" and "rating" are from the default namespace urn:foo. The 'id' attribute
doesn't belong to a namespace since attributes aren't automatically associated
with the default namespace identifier.
Notice that there is no prefix. When a default namespace declaration is used on
an element, all unqualified element names within it's scope are automatically
associated with the specified namespace identifier.
The syntax for default namespaces was designed for convenience but they tend to
cause more confusion than their worth. The confusion typically stems from the
fact that elements and attributes are treated differently and it's not
immediately apparent that nested elements are being assigned the default
namespace identifier. Nevertheless, in the end, choosing between prefixes and
default namespaces is mostly a matter of style, except when attributes come
into play.
|