Re: Namespacing RDFa attributes in custom XML vocabularies

On Mon, 21 Jun 2010 11:12:04 -0500
Alan Jeffrey <ajeffrey@bell-labs.com> wrote:

> RDFa requires that RDFa attributes be in the 
> default anonymous namespace, for example:
> 
>    <example xmlns="http://ex.com/" about="http://ex.com/foo"
>      rel="http://ex.com/bar" href="http://ex.com/baz"/>
> 
> is fine, but the same document in a named namespace is not:
> 
>    <ns:example xmlns:ns="http://ex.com/" ns:about="http://ex.com/foo"
>      ns:rel="http://ex.com/bar" ns:href="http://ex.com/baz"/>

Though the following should be fine:

	<ns:example xmlns:ns="http://ex.com/"
		about="http://ex.com/foo"
		rel="http://ex.com/bar"
		href="http://ex.com/baz" />

There is actually one RDFa host language that uses namespace-prefixed
RDFa attributes: OpenDocument Format 1.2. (It puts them in the
namespace <http://www.w3.org/1999/xhtml>.) I'm not entirely sure what
their reasoning for this was.

A reason to allow an alternative RDFa namespace in RDFa Core (though
for backwards compatibility, we'd need to continue to support the null
namespace) would be a commonly used XML tool that lacks support for
non-namespaced attributes, but in my experience none seem to have a
problem - the DOM, XSLT, XPath, XQuery, etc should all be OK. Frankly
they have to be OK, because otherwise they'd not be able to process any
of the many languages that use non-namespaced attributes, including
XHTML, SVG, Atom, MathML, etc.

I'm not convinced so-far that there's a case for adding this to RDFa
Core. If you know of real-life tools that the current RDFa attributes
cause problems for, then do please follow up. As OpenDocument shows,
host languages can already choose to place the RDFa attributes in an
alternative namespace, but they do so at the cost of compatibility with
generic RDFa processors.

For what it's worth, the latest development version of my RDFa parser
(RDF::RDFa::Parser - this is the parser that powers check.rdfa.info)
does allow for namespaced attributes (though all the attributes have to
reside in the same namespace as each other). There is a little hack you
can use to enable it:

	<meta
	name="http://search.cpan.org/dist/RDF-RDFa-Parser/#auto_config"
	content="ns=http://example.com/some-namespace" />

This can be used in non-XHTML/HTML content too:

	<x:meta xmlns:x="http://www.w3.org/1999/xhtml"
	name="http://search.cpan.org/dist/RDF-RDFa-Parser/#auto_config"
	content="ns=http://example.com/some-namespace" />

Auto-config is (clearly) a parser-specific feature, really just
intended for testing interesting/experimental features of
RDF::RDFa::Parser.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Tuesday, 22 June 2010 20:08:36 UTC