[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Pragmatic namespaces

  • From: Tim Bray <Tim.Bray@Sun.COM>
  • To: Micah Dubinko <micah.dubinko@marklogic.com>
  • Date: Tue, 04 Aug 2009 09:46:31 -0700

Re:  Pragmatic namespaces

On Jul 31, 2009, at 4:06 PM, Micah Dubinko wrote:

> Point 1:
> Any element name with no dots in it is treated as HTML (including  
> HTML rules on handing unrecognized elements)
>
> Requirement: this solution must allow for distributed creation of  
> globally-unique namespace names (including those outside of a  
> consensus process)
>
> Point 2:
> Any element with one or more dots in it is treated as an extension  
> element. The portion after the last dot is considered the localname,  
> and the the portion up to but not including the last dot is parsed  
> as the pragmatic namespace name (or pname for short).

OK, stop there.  Why not just make a clean break with namespaces and  
do extensibility with java-style dot-separated pathnames?  It's  
trivially easy to understand and offers distributed extensibility for  
free.  Trying to shoehorn it onto existing namespace-aware APIs is  
going to be awkward and may not buy much.

I'm trying to remember if anybody proposed this Back In The Day, but  
coming up empty.  -T

> Interfaces with existing namespace-aware APIs must treat the pname  
> as the namespace URI. With the exception noted below, to prevent  
> clashes pnames must be based on reversed DNS names.
>
> Example:
> <head>
>  <title>Document title</title>
>  <com.example.project>
>    <com.example.id>123521123</com.example.id>
>  </com.example.project>
> </head>
>
> In this example document.getElementsByTagName("id") would return the  
> innermost element.
> So would document.getElementsByTagNameNS("com.example", "id")
>
> Requirement: it is highly desirable to produce a document that will  
> produce the same element names in HTML or XML
>
> Point 3:
> Zero or more special attributes of the form using.<pname> may appear  
> on the root element, and ONLY on the root element. The declarations  
> have document-wide scope. The pname that appears after "using." is  
> the one being declared. The value of the attribute is a space- 
> separated list of localnames that represent boundary elements, in  
> other words, upon reaching a boundary element, a new namespace gets  
> applied to that element and all children (until encountering another  
> boundary element).
>
> Example equivalent to the previous:
> <html using.com.example="project">
> <head>
>  <project>
>    <id>123521123</id>
>  </project>
> </head>
>
> This structure will produce the same element names in an XML parser,  
> and a straightforward transformation could convert it to true XML 
> +Namespaces.
>
> Requirement: widely-known namespaces must be parse to an equivalent  
> DOM as xmlns
>
> Point 4:
> In any extension element with only one dot, the token before the  
> first dot is treated specially. Specifically, there exists a list of  
> grandfathered namespaces, and associated namespace URIs. Interfaces  
> with existing namespace-aware APIs must treat the grandfathered  
> namespace URI as the namespace URI of the extension element.
>
> Here is the list: (additional suggestions welcome)
>
> atom http://www.w3.org/2005/Atom
> docbook http://docbook.org/ns/docbook
> html http://www.w3.org/1999/xhtml
> math http://www.w3.org/1998/Math/MathML/
> svg http://www.w3.org/2000/svg
> xbl http://www.mozilla.org/xbl
> xbl2 http://www.w3.org/ns/xbl
> xforms http://www.w3.org/2002/xforms
> xlink http://www.w3.org/1999/xlink
> xml http://www.w3.org/XML/1998/namespace
>
> Example:
>
> <html using.math="math">...
> <p>
> E.g. <math><msqrt><mi>π</mi></msqrt></math>
> </p>
> ...</html>
>
> In this example document.getElementsByTagName("mi") would return the  
> innermost element.
> So would document.getElementsByTagNameNS("http://www.w3.org/1998/Math/MathML/ 
> ", "mi")
>
> Requirement: must support HTML nested inside an extension vocabulary.
>
> Point 5:
> Unless overridden, HTML documents are treated as if all localnames  
> explicitly listed in the specification are HTML boundary elements.
>
> Example:
> <html using.svg="svg">
>  <body>
>    <svg version="1.1"  viewBox="0 0 100 100"  
> preserveAspectRatio="xMidYMid slice">
>      <rect x="10" y="10" width="100" height="150" fill="gray"/>
>      <foreignObject x="10" y="10" width="100" height="150">
>        <body>
>          <div>Here is a <strong>paragraph</strong>.</div>
>        </body>
>      </foreignObject>
>    </svg>
>  </body>
> </html>
>
> Here the inner body element and its children are still treated as  
> HTML.
>
> Another example:
> <html using.xforms="model select1 range secret">
>  <head>
>    <model>...</model>
>  </head>
>  </body>
>    <xforms.input>...
>  </body>
> </html>
>
> In this case, "input" is already used as an HTML element name, so  
> uses of it--even with the using statement at the top--need to be  
> explicitly spelled out. Of course, the author could have overridden  
> this by including "input" in the using statement, but then any  
> regular HTML input controls would need to be spelled <html.input>.  
> Just like in Java.
>
> That's the entire proposal.
>
> In practice, it may be inevitable that browser makers might bake in  
> additional defaults, like
> using.math="math mi mo ms mn mtext"
> such that users can freely use chosen vocabularies with zero  
> additional markup. Support for this outcome is an additional feature  
> of this proposal.
>
> ---
>
> I will be at Balisage this year. If you have comments or ideas, look  
> me up. Comments on this list are welcome as well.
>
>
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.