[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Global/Local attributes
----- Original Message ----- > > > Then what is the point of having the default namespace? > > what's the point of having a namspace prefix of "wibble:"? > there is no point in any particular prefix, there is a point in having a > choice. Yes, but there are different rules for namespaces that have a prefix and namespaces that don't. So there is a great deal of difference between the "" prefix and the "wibble:" prefix. > > Yes, that's what the default namespace is. Of course, that also just > > happens to be the same format for local elements and attributes (what I > > refer to as being in the "document namespace"). > > It's hard to have a conversation about the namespace spec if you use the > word "namespace" but just define it privately rather than using the > definition in the spec. Okay, I will leave out "document namespace". Yes, that's what the default namespace is. Of course, that also just happens to be the same format for elements that do not belong to a namespace. > > What is the point of having the default namespace? > > using short prefixes is not very interesting to machines, but sometimes > useful for humans. "" is particulary good for that and as Thomas (I > think) said it's useful as a way of converting legacy documents (or > legacy authors). This seems like a faulty reasoning. I have a document that looks like: <elem> <elem2 attr="" /> </elem> So you decide to put my legacy document in a declared namespace (using the default namespace declaration): <elem xmlns="http://example.com/"> <elem2 attr="" /> </elem> But wait! Now my "attr" has gone from being in the same non-namespace as the other elements to being the only thing in the non-namespace. I don't see out you could possibly consider the two documents above equivalent. The only way to ensure that all of the attributes and elements stay in the same namespace would be to use a prefix. (of course, if attributes could belong to the default namespace, this would not be as much an issue, but you already point out that this would be a "radical" change in the way namespaces work.) > It's a lot easier to tell people to stick xmlns="lkhhglhgl" at the top > of their XHTML file but then write something that looks basically like > html than to tell people to write > <xhtml:a href="..." or <xhtml:a xhtml:href="..." > all over the place. It doesn't make much difference to the browser > whether "" or "xhtml:" is used but if you are writing the input by hand > it does make a difference. So, if you have something like the following (from [1]): <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Virtual Library</title> </head> <body> <p>Moved to <a href="http://example.org/">example.org</a>.</p> </body> </html> This is different from: <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <xhtml:head> <xhtml:title>Virtual Library</xhtml:title> </xhtml:head> <xhtml:body> <xhtml:p>Moved to <xhtml:a xhtml:href="http://example.org/">example.org</xhstml:a>.</xhtml:p> </xhtml:body> </xhtml:html> While the first version may be easier for people to hand code, "href" (and any other intended xhtml attributes) are still not in a namespace. To me, this essentially breaks the document. Sure, you could "imply" that the attributes are in the same namespace, but then you are in violation of the Namespace rec. The only way to ensure that all xhtml elements and attributes are properly in the same namespace are to use a named prefix. --- Seairth Jacobs seairth@s... [1] http://www.w3.org/TR/xhtml1/#docconf
|
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
|