[
Lists Home |
Date Index |
Thread Index
]
Thanks to all who replied and getting my doubts cleared..
Regards,
Mukul
On 7/16/06, Dimitre Novatchev <dnovatchev@yahoo.com> wrote:
>
> "Mukul Gandhi" <gandhi.mukul@gmail.com> wrote in message
> 7870f82e0607151005nd7094fboc43dd7ecdc9b360a@mail.gmail.com">news:7870f82e0607151005nd7094fboc43dd7ecdc9b360a@mail.gmail.com...
> > The XML Namespaces Recommendation says that the default namespace
> > applies only to elements, and not to attribues
> > (http://www.w3.org/TR/REC-xml-names/#defaulting).
> >
> > i.e. an unprefixed attribute name will always be in the null namespace.
> >
> > I am curious to know why this is so?
>
>
> It seems to have some reason:
>
> An attribute belongs to an element and its semantics must be defined as
> part of the semantics of the parent-element. Therefore, additionally there
> is no need to put the attribute in the same namespace as the one of its
> parent.
>
> On the other side, if we want to specify on a given element a "special"
> attribute that is not specific only to that element, but is "globally
> defined and owned", then having this attribute in some namespace will serve
> to give the attribute this semantics and be able to distinguish this
> attribute from the attributes that are ("local") specific only for the
> element or from other "global" attributes.
>
> This is how we generally specify such attributes as xml:lang, xml:id,
> xsi:type, ..., etc.
>
> Exactly because local attributes do not belong to any namespace and their
> names do not have prefixes, it is easy to distinguish the global attributes
> whenever they are specified on an element.
>
> So, my understanding is that one goal of this part of the namespace spec
> was to provide a way of specifying attributes that would be easy to
> understand and that would allow special/global attributes to be seen easily,
> avoiding namespace-prefix clutter altogether.
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
|