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

Re: Request to publish HTML+RDFa (draft 3) as FPWD

From: Mark Birbeck <mark.birbeck@webbackplane.com>
Date: Tue, 22 Sep 2009 23:58:39 +0100
Message-ID: <640dd5060909221558r1247ae53q31414b113db3a85c@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Shane McCarron <shane@aptest.com>, Henri Sivonen <hsivonen@iki.fi>, HTMLWG WG <public-html@w3.org>, RDFa mailing list <public-rdf-in-xhtml-tf@w3.org>
Hi Jonas,

> For example, if I have a DOM and I want to do map the prefix "foo",
> which of the following algorithms should I use:
> 1. Call Node.lookupNamespacePrefix as defined by DOM Level 3 using
> "foo" as the prefix argument.
> 2. Walk up the parent chain looking for an element with an attribute
> with localName "foo" and namespace "http://www.w3.org/2000/xmlns/",
> and then use the value of that attribute.
> 3. Walk up the parent chain looking for an element with an attribute
> with tagName "xmlns:foo", and then use the value of that attribute.
> 4. Walk up the parent chain looking for either the attribute in 2 or
> 3, and if both are specified use some prioritization order.
> 5. Walk up the parent chain looking for either the attribute in 2 if
> the document was parsed as XHTML, or attribute in 3 if the document
> was parsed as HTML.
> 6. Do something else?
>
> Any of 1 to 5 (as well as possibly 6) seems equally valid to me, and
> as far as I can tell there really is no specified answer.

I disagree with other comments that have implied that you could use
any of your 5 proposals -- you can't.

The algorithm is clearly defined in the RDFa spec, and consists of:

 * visit each element in the tree, depth-first;

 * before doing any processing on an element, extract any prefix
mappings, and add them to
   the 'current context';

 * before visiting each child element, push the 'current context' to a stack;

 * on completion of a child element, pop the 'current context' back off again.

This algorithm is completely independent of how the prefix mappings
were obtained.

These mappings could have been provided using the attribute @banana,
containing syntax like "ex=http://example.org".

(And there is discussion about providing some additional mechanism to
provide these mappings.)

But for now, the only mechanism available is that any attribute that
conforms to the pattern described in [XMLNS], is interpreted as
providing a prefix mapping.

So as you can see, there is no need for namespace support on the DOM
(option 1), although if it's available it can be used -- that's up to
the programmer.

And there is definitely no need to traverse up the tree every time you
need to evaluate a prefix (options 2 to 5), since the RDFa parsing
algorithm has all of the in-scope prefix mappings available in the
'current context'.

Regards,

Mark

--
Mark Birbeck, webBackplane

mark.birbeck@webBackplane.com

http://webBackplane.com/mark-birbeck

webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)
Received on Tuesday, 22 September 2009 22:59:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:48 GMT