Re: DOM based API

On Mon, Jun 9, 2008 at 4:44 PM, Ian Hickson <ian@hixie.ch> wrote:
> There certainly is a group of people on this mailing list who want an API
> and not a markup language. It may be that to optimally address the use
> cases and requirements of that group of people as well as the group of
> people who want a markup language, we will need two specs. I believe
> Andrei is volunteering to edit the spec that defines the API. If anyone
> wants to volunteer to write a spec to define a markup language, I think
> that would be great. A good place to put it would be:
>
>   http://dev.w3.org/geo/ml/
>
> Alternatively, we could reuse the geo Microformat as the markup language.

Good idea.  It's a start.

Unfortunately the microformat has too many forms to make unconstrained
access practical (without a geo-parsing library), but here's how it
could look, just to give everybody a concrete example so you can
understand what I'm talking about.

<html>
  <head />
  <body>
    <div id="present" class="geo">
      <span class="latitude" >xx.xx</span>
      <span class="longitude">yy.yy</span>
    </div>
  </body>
</html>

Then you'd have;

   lat = Location.getElementById("present").getElementsByClassName("geo")[0].getElementsByClassName("latitude").innerHTML;

Which is obviously a bit of a mouthful, but with access to a CSS or
XPath selectors library, that would of course become a whole lot
simpler, e.g.

  #present.latitude

The general idea here - as with microformats themselves - is to reuse
as much existing deployed agreement as possible.  I think the DOM +
HTML semantics is a very useful and expressive starting point, but
would also be agreeable to using DOM + a custom markup language if it
were deemed necessary.

Cheers,

Mark.
-- 
Mark Baker. Ottawa, Ontario, CANADA. http://www.markbaker.ca
Coactus; Web-inspired integration strategies http://www.coactus.com

Received on Saturday, 28 June 2008 05:29:51 UTC