W3C home > Mailing lists > Public > public-html@w3.org > October 2009

Re: Microdata Issues [was Microdata design philosophies]

From: Philip Jägenstedt <philipj@opera.com>
Date: Tue, 20 Oct 2009 09:52:03 +0200
To: martin@weborganics.co.uk, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "Leif Halvard Silli" <xn--mlform-iua@xn--mlform-iua.no>, "Ian Hickson" <ian@hixie.ch>, public-html@w3.org
Message-ID: <op.u129g1ftatwj1d@sisko.linkoping.osa>
On Tue, 20 Oct 2009 03:10:13 +0200, Martin McEvoy  
<martin@weborganics.co.uk> wrote:
> Tab Atkins Jr. wrote:
>> I'm confused about your assertion about "attribute is part of a custom
>> vocab made for just my use as useful script or css hooks", though.
>> Microdata is *not* very useful as a script or CSS hook.
> I know it isn't,  what do you think Philip meant when he said this ...
> "the microdata DOM API is useful in that it allows scripts to read and  
> modify the data of a document with a relatively simple syntax. Otherwise  
> you'd have to write many helper functions or wrapper objects to hide the  
> underlying DOM tree."
> sounds like he is talking about scripts reading and writing to the dom  
> to me...I may be wrong though...

I really don't know what the actual issue we are discussing is any longer,  
but I'll explain in a few paragraph when I think the microdata DOM API  
might be useful.

First, assume that you've marked up your HTML with microdata for the  
benefit of external scrapers, to complement or replace an XML or JSON  
webservice. If you want to make some visualizations of that data using  
JavaScript (e.g. by generating a SVG or <canvas> graph), scraping the raw  
data from the DOM will be very easy using document.getItems(). If it isn't  
easy, then it won't be for the external parsers either and you have a more  
serious problem to worry about. Changing property values (e.g. in response  
to interaction with said graph) can also be done via the same API from  
which you read it.

If you use "semantic" class names, then you have double the work to mark  
it up and have to write specialized code to scrape the data from the DOM.  
If you want to read and write data via a consistent interface you'll need  
to write wrapper objects using getters and setters (or getFoo()/setFoo())  
that hide the fact that some properties are the child text nodes, while  
others are in different attributes, as is the case with e.g. form elements.

Of course everything above can be done without the microdata DOM API, but  
having external and on-site scrapers use the same data rather than  
duplicating it makes perfect sense. Everyone, unless I've written  
something outrageously wrong, please do not follow my example of replying  
without knowing what the problem under discussion is.

Philip Jägenstedt
Core Developer
Opera Software
Received on Tuesday, 20 October 2009 07:52:47 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:01 UTC