[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Default namespace for attributes?
Thanks to all who replied and getting my doubts cleared.. Regards, Mukul On 7/16/06, Dimitre Novatchev <dnovatchev@y...> wrote: > > "Mukul Gandhi" <gandhi.mukul@g...> wrote in message > 7870f82e0607151005nd7094fboc43dd7ecdc9b360a@m...">news:7870f82e0607151005nd7094fboc43dd7ecdc9b360a@m...... > > 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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|